New submission from Shaun Cutts <shauncu...@users.sourceforge.net>:

Line 335 of copy.py guards call to __setstate__ with

if state:
    ...

However, __getstate__ may legitimately return an empty dictionary even
if __setstate__ still needs to be called. For example,
__setstate__/__getstate__ pair may not want to "persist" default values
(as is the case for me).

The fix would be to change this line to (e.g.):

if state is not None:
    ...

----------
components: Library (Lib)
files: deepcopy_bug.py
messages: 92186
nosy: shauncutts
severity: normal
status: open
title: deepcopy erroneously doesn't call __setstate__ if __getstate__ returns 
empty dict
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file14822/deepcopy_bug.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to