This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author raoul_gough_baml
Recipients raoul_gough_baml, serhiy.storchaka
Date 2016-12-15.10:00:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481796056.19.0.415850604798.issue28925@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-12-15 10:00:56raoul_gough_bamlsetrecipients: + raoul_gough_baml, serhiy.storchaka
2016-12-15 10:00:56raoul_gough_bamlsetmessageid: <1481796056.19.0.415850604798.issue28925@psf.upfronthosting.co.za>
2016-12-15 10:00:56raoul_gough_bamllinkissue28925 messages
2016-12-15 10:00:55raoul_gough_bamlcreate