[Python-bugs-list] [ python-Bugs-520645 ] unpickable basic types => confusing err
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 14 Mar 2002 11:23:09 -0800
Bugs item #520645, was opened at 2002-02-20 16:00
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=520645&group_id=5470
Category: Type/class unification
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Samuele Pedroni (pedronis)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: unpickable basic types => confusing err
Initial Comment:
E.g.
Python 2.2
>>> f=open('c:/autoexec.bat','r')
>>> w=open('c:/transit/p','w')
>>> import pickle as pic
>>> pic.dump(f,w)
Traceback (most recent call last):
<<snip>>
TypeError: coercing to Unicode: need string or buffer,
file found
>>> import cPickle as cpic
>>> cpic.dump(f,w)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "C:\USR\PYTHON22\lib\copy_reg.py", line 56, in
_reduce
state = base(self)
TypeError: coercing to Unicode: need string or buffer,
file found
VS.
Python 2.1
>>> f=open('c:/autoexec.bat','r')
>>> w=open('c:/transit/p','w')
>>> import pickle as pic
>>> pic.dump(f,w)
Traceback (most recent call last):
<<snip>>
pickle.PicklingError: can't pickle 'file' object:
<open file 'c:/autoexec.bat',
mode 'r' at 00795290>
>>> import cPickle as cpic
>>> cpic.dump(f,w)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
cPickle.UnpickleableError: Cannot pickle <type 'file'>
objects
>>>
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-03-14 14:23
Message:
Logged In: YES
user_id=6380
I cannot reproduce this on the 2.2.1 branch or on the CVS
trunk. I believe it was fixed by rev. 2.10 of copy_reg.py
(without this even being the intention :-).
Closing.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=520645&group_id=5470