[Python-bugs-list] [ python-Bugs-634905 ] segfault unpickling Numeric 'O' array
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 07 Nov 2002 02:56:26 -0800
Bugs item #634905, was opened at 2002-11-07 10:56
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=634905&group_id=5470
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Raik Gruenberg (graik)
Assigned to: Nobody/Anonymous (nobody)
Summary: segfault unpickling Numeric 'O' array
Initial Comment:
A numpy array of objects can only be unpickled in the
same Python interpreter where it was pickled. Otherwise
a segmentation fault occurs when the unpickled array is
first accessed.
Python version: all tested (2.1 and 2.2 and 2.2.1)
OS: all tested (Linux rh 7.1 and 7.3, MacOSX)
Numeric version: 22
EXAMPLE:
-------------
import sys
from Numeric import *
import cPickle
list = [{'name':'A', 'x':1}, {'name':'B', 'x':2}]
mask = [1,1]
rlist = compress( mask, list )
## rlist = rlist.tolist() ## work-around
f = open( 'r.dat', 'w' )
r = cPickle.dump( rlist, f, 0) ## same with bin=1 or
pickle.dump
f.close()
sys.exit(0)
## RESTART PYTHON INTERPRETER HERE
## (otherwise no segFault)
import cPickle
f = open( 'r.dat')
r = cPickle.load(f) ## same with pickle.load
f.close()
## causes SEGFAULT:
print r
----------
The bug could probably also be submitted to the Numeric
team.
Greetings
Raik
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=634905&group_id=5470