This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年02月03日 18:18 by alga, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg98793 - (view) | Author: Albertas Agejevas (alga) | Date: 2010年02月03日 18:18 | |
When copy.copy is used on an object whose __getstate__ returns 0, it can produce a corrupt copy of an object: >>> import copy >>> class Foo(object): ... def __init__(self): ... self.value = 0 ... def __getstate__(self): ... return self.value ... def __setstate__(self, v): ... self.value = v ... >>> one = Foo() >>> two = copy.copy(one) >>> two.value Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'Foo' object has no attribute 'value' Pickling/unpickling works fine for this object, so this appears to be a bug in copy._reconstruct. This is not a contrived example, BTrees.Length.Length from ZODB uses such a __getstate__. |
|||
| msg98822 - (view) | Author: Albertas Agejevas (alga) | Date: 2010年02月04日 10:09 | |
This bug is a duplicate of issue6827, sorry. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:57 | admin | set | github: 52096 |
| 2010年02月07日 09:33:11 | georg.brandl | set | status: open -> closed |
| 2010年02月04日 16:23:53 | r.david.murray | set | priority: normal resolution: duplicate superseder: deepcopy erroneously doesn't call __setstate__ if __getstate__ returns empty dict stage: resolved |
| 2010年02月04日 12:43:56 | pitrou | set | nosy:
+ alexandre.vassalotti |
| 2010年02月04日 10:09:45 | alga | set | messages: + msg98822 |
| 2010年02月03日 18:18:43 | alga | create | |