New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copy raises SystemError when getstate raises exception #38598
Comments
I'm sorry that I'm so far unable to track this down $ ./brian.py
mcop warning: user defined signal handler found for
SIG_PIPE, overriding
Traceback (most recent call last):
File "./brian.py", line 265, in ?
main()
File "./brian.py", line 235, in main
game.mainloop()
File "./brian.py", line 100, in mainloop
self.save(self.savefile)
File "./brian.py", line 216, in save
self.level.save(fp)
File "level.py", line 113, in save
cPickle.dump(self, f, -1)
SystemError: NULL object passed to Py_BuildValue
$ python -c 'import sys;print sys.version'
2.3b1+ (#2, Jun 4 2003, 17:16:59)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] When I use (Py)pickle instead of cPickle, the traceback $ ./brian.py
mcop warning: user defined signal handler found for
SIG_PIPE, overriding
Traceback (most recent call last):
File "./brian.py", line 266, in ?
main()
File "./brian.py", line 236, in main
game.mainloop()
File "./brian.py", line 100, in mainloop
self.save(self.savefile)
File "./brian.py", line 217, in save
self.level.save(fp)
File "/home/gerrit/cvs/brian/level.py", line 114, in save
cPickle.dump(self, f, -1)
File "/usr/local/lib/python2.3/pickle.py", line 1382,
in dump
Pickler(file, protocol, bin).dump(obj)
File "/usr/local/lib/python2.3/pickle.py", line 231,
in dump
self.save(obj)
File "/usr/local/lib/python2.3/pickle.py", line 338,
in save
self.save_reduce(obj=obj, *rv)
File "/usr/local/lib/python2.3/pickle.py", line 433,
in save_reduce
save(state)
File "/usr/local/lib/python2.3/pickle.py", line 293,
in save
f(self, obj) # Call unbound method with explicit self
File "/usr/local/lib/python2.3/pickle.py", line 663,
in save_dict
self._batch_setitems(obj.iteritems())
File "/usr/local/lib/python2.3/pickle.py", line 695,
in _batch_setitems
save(v)
File "/usr/local/lib/python2.3/pickle.py", line 313,
in save
rv = reduce(self.proto)
SystemError: NULL object passed to Py_BuildValue 'self' is an object whose __dict__ has 4 items. The The interesting part is that if a reference to The full CVS tree of the app concerned is available via I am going to try to track this down further tomorrow Gerrit. |
Logged In: YES OK; one step further. |
Logged In: YES Heh, sorry for replying to my own post so soon, but this |
Logged In: YES OK, I tracked it even further: Copying an old-style class behaves as expected:
47 >>> class Foo:
47 ... def __getstate__(self): 1/0
47 ...
48 >>> copy.copy(Foo())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/copy.py", line 75, in copy
return copier(x)
File "/usr/local/lib/python2.3/copy.py", line 148, in
_copy_inst
state = x.__getstate__()
File "<stdin>", line 2, in __getstate__
ZeroDivisionError: integer division or modulo by zero However, copying a new-style class instance does not: 49 >>> class Foo(object):
49 ... def __getstate__(self): 1/0
49 ...
50 >>> copy.copy(Foo())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/copy.py", line 87, in copy
rv = reductor(2)
SystemError: NULL object passed to Py_BuildValue ...or even easier... 51 >>> class Foo(object):
51 ... def __getstate__(self): raise
51 ...
52 >>> copy.copy(Foo())
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/copy.py", line 87, in copy
rv = reductor(2)
SystemError: NULL object passed to Py_BuildValue That's as close as I can get. |
Logged In: YES Python 2.2 does it right! |
Logged In: YES Checked in as:
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: