[Python-bugs-list] [Bug #112944] Partially initialized cPickle dumps core

noreply@sourceforge.net noreply@sourceforge.net
Wed, 6 Sep 2000 07:45:15 -0700


Bug #112944, was updated on 2000-Aug-28 09:03
Here is a current snapshot of the bug.

Project: Python
Category: Modules
Status: Open
Resolution: None
Bug Group: None
Priority: 7
Summary: Partially initialized cPickle dumps core

Details: The second import of a library that failed the first time does not re-initialize the module, and returns a reference to the uninitialized module:

>>> import cPickle
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named copy_reg
>>> ^P
  File "<stdin>", line 1
    
    ^
SyntaxError: invalid syntax
>>> import cPickle
>>> 

Subsequent use of the uninitialized module crashes the interpreter:

>>> cPickle.Pickler()
Segmentation fault (core dumped)

(and it happens the same way in scripts.)


Follow-Ups:

Date: 2000-Aug-29 14:30
By: gvanrossum

Comment:
The stated problem is not a bug but documented behavior.
However the fact that a partially initialized cPickle dumps core is a cPickle bug. I'll change the topic and see if I can get the cPickle author (Jim Fulton) to look at this.
-------------------------------------------------------

Date: 2000-Sep-06 07:45
By: dcjim

Comment:
The fix is pretty easy. I send Guido a new cPickle.c.

Basically, the init_stuff call needs to be moved to the top of
initcPickle and guarded, like so:

    if (init_stuff(m, d) < 0) return;

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

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=112944&group_id=5470