[New-bugs-announce] [issue2702] pickling of large recursive structures crashes cPickle

Daniel Darabos report at bugs.python.org
Sun Apr 27 09:53:09 CEST 2008


New submission from Daniel Darabos <darabos.daniel at gmail.com>:

The documentation[1] says:

  Trying to pickle a highly recursive data structure may exceed the
  maximum recursion depth, a RuntimeError will be raised in this
  case. You can carefully raise this limit with sys.setrecursionlimit().

The lightweight pickle module handles this problem correctly (in that it
raises a RuntimeError), but cPickle sometimes raises KeyError instead,
or just silently terminates the interpreter (=crashes). (I have not been
able to pinpoint what it depends on. In the attached example I get
silent termination, but if instead of lists I use sets to describe the
connections, I get the RuntimeError.)

This was mentioned in issue 2480, but that has now been changed to a
feature request to eliminate recursion altogether. That may have a lower
priority, but this crash can be hard to diagnose in a complex
application, and I am not sure if sys.setrecursionlimit() affects
cPickle behavior (I guess not).

[1]: http://docs.python.org/lib/node317.html

----------
components: Library (Lib)
files: bugdemo.py
messages: 65876
nosy: alexandre.vassalotti, bkline, cyhawk, jcea, schmir
severity: normal
status: open
title: pickling of large recursive structures crashes cPickle
type: crash
versions: Python 2.5
Added file: http://bugs.python.org/file10119/bugdemo.py

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2702>
__________________________________


More information about the New-bugs-announce mailing list