Message283272
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. |
|
Date |
User |
Action |
Args |
2016-12-15 10:00:56 | raoul_gough_baml | set | recipients:
+ raoul_gough_baml, serhiy.storchaka |
2016-12-15 10:00:56 | raoul_gough_baml | set | messageid: <1481796056.19.0.415850604798.issue28925@psf.upfronthosting.co.za> |
2016-12-15 10:00:56 | raoul_gough_baml | link | issue28925 messages |
2016-12-15 10:00:55 | raoul_gough_baml | create | |
|