[issue4176] segfault with pickle if 4th or 5th item of tuple returned by __reduce__ is not an iterator

Alexandre Vassalotti report at bugs.python.org
Fri Oct 31 02:04:50 CET 2008


Alexandre Vassalotti <alexandre at peadrop.com> added the comment:

Thank you, Amaury, for fixing this. However, you forgot to also patch
the Python implementation of pickle, which makes the following test fail:

======================================================================
FAIL: test_reduce_bad_iterator (__main__.PyPicklerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/alex/src/python.org/py3k/Lib/test/pickletester.py", line
892, in test_reduce_bad_iterator
    self.assertRaises(pickle.PickleError, self.dumps, C(), proto)
AssertionError: PickleError not raised by dumps


Also, I am not sure if moving the type and length check of the reduce
value into save_reduce() was a good idea. In pickle.py, the check must 
be done before calling save_reduce(), since the method is called with
the star-syntax "self.save_reduce(obj=obj, *rv)". In _pickle, there's no
such requirement; however I don't like the idea of adding needless
differences.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4176>
_______________________________________


More information about the Python-bugs-list mailing list