[Python-bugs-list] [ python-Bugs-759889 ] Pickling of Random is broken
SourceForge.net
noreply@sourceforge.net
Tue, 24 Jun 2003 10:18:10 -0700
Bugs item #759889, was opened at 2003-06-24 10:40
Message generated for change (Comment added) made by rhettinger
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=759889&group_id=5470
Category: Extension Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Frank McIngvale (frankmci)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: Pickling of Random is broken
Initial Comment:
The following shows pickling of Randoms doesn't work in
2.3b1
Python 2.3b1 (#1, Jun 17 2003, 17:56:12)
[GCC 2.95.3 20010315 (release)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import pickle
>>> import random
>>> r = random.Random()
>>> pickle.dumps(r)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/pickle.py", line 1386, in
dumps
Pickler(file, protocol, bin).dump(obj)
File "/usr/lib/python2.3/pickle.py", line 231, in
dump
self.save(obj)
File "/usr/lib/python2.3/pickle.py", line 338, in
save
self.save_reduce(obj=obj, *rv)
File "/usr/lib/python2.3/pickle.py", line 415, in
save_reduce
save(args)
File "/usr/lib/python2.3/pickle.py", line 293, in
save
f(self, obj) # Call unbound method with explicit
self
File "/usr/lib/python2.3/pickle.py", line 576, in
save_tuple
save(element)
File "/usr/lib/python2.3/pickle.py", line 313, in
save
rv = reduce(self.proto)
File "/usr/lib/python2.3/copy_reg.py", line 61, in
_reduce_ex
raise TypeError, "can't pickle %s objects" %
base.__name__
TypeError: can't pickle Random objects
>>>
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-06-24 12:18
Message:
Logged In: YES
user_id=80475
I cannot reproduce the error in Py2.3b1+:
Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> import random
>>> import pickle
>>> r = random.Random()
>>> pickle.dumps(r)
'(irandom\nRandom\np0\n(I1\n(I17199\nI25463\nI295
\ntp2\nNtp3\nb.'
The pickling tools had been updated recently and may have
had a bug that was subsequently fixed. Will add this to the
test suite to make sure the bug stays dead. If the new test
doesn't provoke failure on some other platform, will mark
this one as fixed and will close the bug report.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=759889&group_id=5470