Issue 1101399: dict subclass breaks cPickle noload() (original) (raw)

Created on 2005-01-13 04:37 by nascheme, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
noload.py nascheme,2005-01-13 04:37
noload_setitem.txt nascheme,2005-01-13 04:54 patch to add noload_setitem
noload-patch2.txt nascheme,2005-01-14 00:06 version 2 of patch
Messages (7)
msg23945 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2005-01-13 04:37
The attached script displays the bug.
msg23946 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2005-01-13 04:54
Logged In: YES user_id=35752 Attached is a patch that seems to fix the problem. Someone please review it.
msg23947 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-01-13 18:28
Logged In: YES user_id=31435 Oh. fudge. I'd like to say that since noload() is wholly undocumented, tough luck . 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.
msg23948 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2005-01-14 00:06
Logged In: YES user_id=35752 New patch. Checks for invalid marker as suggested by Tim. It also add noload_append() and noload_appends().
msg23949 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-01-14 00:24
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 .
msg82110 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-14 19:08
Confirmed on trunk, traceback: Traceback (most recent call last): File "~/Desktop/noload.py", line 12, in u.noload() TypeError: 'NoneType' object does not support item assignment
msg94020 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2009-10-14 19:41
Applied to 2.x trunk. The 3.x version _pickle.c doesn't have the noload method.
History
Date User Action Args
2022-04-11 14:56:09 admin set github: 41435
2009-10-14 19:41:50 nascheme set status: open -> closedresolution: acceptedmessages: +
2009-02-14 19:08:56 ajaksu2 set type: behaviorstage: test neededmessages: + nosy: + ajaksu2versions: + Python 2.6
2005-01-13 04:37:32 nascheme create