This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: dict subclass breaks cPickle noload()
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: dcjim Nosy List: ajaksu2, dcjim, nascheme, tim.peters
Priority: normal Keywords:

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 <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.
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 <wink>.
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 <module>
    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:09adminsetgithub: 41435
2009-10-14 19:41:50naschemesetstatus: open -> closed
resolution: accepted
messages: + msg94020
2009-02-14 19:08:56ajaksu2settype: behavior
stage: test needed
messages: + msg82110
nosy: + ajaksu2
versions: + Python 2.6
2005-01-13 04:37:32naschemecreate