[ python-Bugs-1101399 ] dict subclass breaks cPickle noload()
SourceForge.net
noreply at sourceforge.net
Fri Jan 14 01:24:13 CET 2005
Bugs item #1101399, was opened at 2005-01-12 23:37
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1101399&group_id=5470
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Neil Schemenauer (nascheme)
Assigned to: Jim Fulton (dcjim)
Summary: dict subclass breaks cPickle noload()
Initial Comment:
The attached script displays the bug.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2005-01-13 19:24
Message:
Logged In: YES
user_id=31435
Yup, good catch on append/appends too. Moral dilemma:
should undocumented features be tested? That's a slippery
slope in cPickle <wink>.
----------------------------------------------------------------------
Comment By: Neil Schemenauer (nascheme)
Date: 2005-01-13 19:06
Message:
Logged In: YES
user_id=35752
New patch. Checks for invalid marker as suggested by Tim.
It also add noload_append() and noload_appends().
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2005-01-13 13:28
Message:
Logged In: YES
user_id=31435
Oh. fudge. I'd like to say that since noload() is wholly
undocumented, tough luck <wink>.
The GLOBAL and NEWOBJ opcodes just stick None on the
stack in noload()-mode. That's why the test script yields
TypeError: object does not support item assignment
(SETITEM is griping about the None noload()'s NEWOBJ left
behind). I agree your patch fixes that, and offhand can't
think of a more principled approach. Assigning to Jim in case
he can.
In any case, please put the marker() call on a different line
and check its return value. I know some other code in
cPickle takes the shortcut you're using, but it's not a good
idea to grow more code like that (it changes what would
have been a clear ""could not find MARK" error into a more
mysterious "unpickling stack underflow" error).
It would be good to get this fixed in 2.3.5 too.
----------------------------------------------------------------------
Comment By: Neil Schemenauer (nascheme)
Date: 2005-01-12 23:54
Message:
Logged In: YES
user_id=35752
Attached is a patch that seems to fix the problem. Someone
please review it.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1101399&group_id=5470
More information about the Python-bugs-list
mailing list