[Python-bugs-list] [ python-Bugs-668925 ] 2.3 can't pickle bool objects -- breaks deepcopy
SourceForge.net
noreply@sourceforge.net
Thu, 16 Jan 2003 02:43:25 -0800
Bugs item #668925, was opened at 2003-01-16 07:58
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=668925&group_id=5470
Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: David Ripton (dripton)
Assigned to: Nobody/Anonymous (nobody)
Summary: 2.3 can't pickle bool objects -- breaks deepcopy
Initial Comment:
A class which includes some logically Boolean fields is
cloned using copy.deepcopy
In Python 2.2.2, the logically Boolean fields are
actually ints, and this works fine.
In 2.3a1, they're real bools, and I get an error
deepcopying the class.
Simplified example that shows the problem:
Python 2.3a1 (#1, Jan 15 2003, 22:01:37)
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import copy
>>> li = [True]
>>> li2 = copy.deepcopy(li)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/copy.py", line 186, in
deepcopy
y = copierfunction(x, memo)
File "/usr/local/lib/python2.3/copy.py", line 219, in
_deepcopy_list
y.append(deepcopy(a, memo))
File "/usr/local/lib/python2.3/copy.py", line 182, in
deepcopy
y = _reconstruct(x, reductor(), 1, memo)
File "/usr/local/lib/python2.3/copy_reg.py", line 57,
in _reduce
raise TypeError, "can't pickle %s objects" %
base.__name__
TypeError: can't pickle bool objects
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2003-01-16 11:43
Message:
Logged In: YES
user_id=21627
Thanks for the report. Pickling booleans actually was
supports - just copying them was not. This is fixed in
copy.py 1.30.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=668925&group_id=5470