enthought/traits — Issue #10: Copying a Dict trait doesn't work correctly
Author: sjagoe
Created: 2011-11-17 16:10:59+00:00
State: open

```python
from traits.api import HasTraits, Dict
import copy

class Foo(HasTraits):
d = Dict

foo = Foo()
foo.d['foo'] = 1
d = copy.copy(foo.d)
d.update({'bar': 3})
```

This results in the following error:

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\dev\projects\ in ()
----> 1 d.update({'bar': 3})

traits-4.0.1-py2.6-win32.egg\traits\trait_handlers.py in update(self, dic)
3177 def update ( self, dic ):
3178 if len( dic ) > 0:
-> 3179 new_dic = self._validate_dic( dic )
3180
3181 if self.name_items is not None:

traits-4.0.1-py2.6-win32.egg\traits\trait_handlers.py in _validate_dic(self, dic)
3261 new_dic = {}
3262
-> 3263 key_validate = self.trait.key_trait.handler.validate
3264 if key_validate is None:
3265 key_validate = lambda object, name, key: key

AttributeError: 'TraitDictObject' object has no attribute 'trait'