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: cPickle.BadPickleGet is a string
Type: Stage:
Components: Extension Modules Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: loewis Nosy List: exarkun, loewis
Priority: normal Keywords:

Created on 2002-09-14 03:51 by exarkun, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cPickle.diff exarkun, 2002-09-14 03:51 cvs diff for cPickle.c
Messages (4)
msg12400 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2002-09-14 03:51
cPickle passes BadPickleGet to PyErr_SetObject() in a
few places.  As raising strings being deprecated, this
seems bad.  The attached patch makes BadPickleGet a
real Exception.  Hopefully this is correct (This is my
first attempt at such a modification).  I don't see any
code in the stdlib that relies on BadPickleGet being a
string, and it seems unlikely that anyone other than
cPickle itself would be using it at all.

The attached patch is against current cvs HEAD.  It
should probably go into the 2.2 branch too (if it or a
similar fix is accepted).
msg12401 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-14 08:44
Logged In: YES 
user_id=21627

Out of curiosity: How did you find out? AFAICT, the
conditions to raise this exception will never trigger unless
the pickle is bad.
msg12402 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2002-09-15 02:28
Logged In: YES 
user_id=366566

Yup, I was testing some error handling code in a project and
noticed that my "except Exception, e:" block was bypassed
when it tried to load an invalid pickle file.  Accidental,
really: I'd forgotten I had a file named "asdasd".
msg12403 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-16 17:27
Logged In: YES 
user_id=21627

Thanks, fixed in cPickle.c 2.96, NEWS 1.484.

The change should *not* go into 2.2, since that might cause
incompatibilities.
History
Date User Action Args
2022-04-10 16:05:40adminsetgithub: 37178
2002-09-14 03:51:51exarkuncreate