Raoul Gough added the comment:
Hi Serhiy, thanks very much for looking at this. My only concern with removing
the code completely is that it does work (presumably as intended) with at least
some of the standard exception types. For example, if you change the demo to
raise and catch a RuntimeError instead of MyException, the output looks like
this:
INFO:root:Creating BadReduce object
INFO:root:Pickling
INFO:root:Unpickling
INFO:root:Raising exception "BadReduce init failed"
INFO:root:Got RuntimeError "(RuntimeError('BadReduce init failed',), <class
'__main__.BadReduce'>, (1123,))"
INFO:root:Done
Where the caught RuntimeError contains the original RuntimeError and some
additional information from cPickle.
I also checked that it correctly propagates KeyboardInterrupt by testing
manually with a sleep:
INFO:root:Creating BadReduce object
INFO:root:Pickling
INFO:root:Unpickling
INFO:root:Sleeping a while - send keyboard interrupt to test
C-c C-cTraceback (most recent call last):
File "/home/zk8ms03/python/cpickle_reduce_failure.py", line 49, in <module>
main()
File "/home/zk8ms03/python/cpickle_reduce_failure.py", line 42, in main
pickler.loads(s1)
File "/home/zk8ms03/python/cpickle_reduce_failure.py", line 28, in __init__
time.sleep(5.0)
KeyboardInterrupt: (None, <class '__main__.BadReduce'>, (1123,))
I'm not sure how likely it is that anyone depends on the extra information that
cPickle adds in these cases, so I'll leave it up to others to decide what's
best.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28925>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com