Bugs item #1099746, was opened at 2005-01-10 21:28 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1099746&group_id=5470
Category: Python Library Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: Doug Winter (winjer) Assigned to: Nobody/Anonymous (nobody) Summary: copy.deepcopy barfs when copying a class derived from dict Initial Comment: I've got a class: class odict(dict): def __init__(self, d={}): self._keys = d.keys() dict.__init__(self, d) def __setitem__(self, key, item): dict.__setitem__(self, key, item) if key not in self._keys: self._keys.append(key) ... When I copy.deepcopy one of these it blows up in __setitem__ with an AttributeError on _keys, because __setitem__ is called without __init__ ever having been called. Presumably this thing looks and smells like a dictionary, so deepcopy thinks it is one. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1099746&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com