[Python-bugs-list] [ python-Bugs-609164 ] cPickle.BadPickleGet is a string

noreply@sourceforge.net noreply@sourceforge.net
Sat, 14 Sep 2002 19:28:17 -0700


Bugs item #609164, was opened at 2002-09-13 23:51
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=609164&group_id=5470

Category: Extension Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Jp Calderone (kuran)
Assigned to: Nobody/Anonymous (nobody)
Summary: cPickle.BadPickleGet is a string

Initial Comment:
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).


----------------------------------------------------------------------

>Comment By: Jp Calderone (kuran)
Date: 2002-09-14 22:28

Message:
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".


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-09-14 04:44

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=609164&group_id=5470