Serhiy Storchaka added the comment:
True. Attributes __context__, __cause__ and __traceback__ are not pickled. The
traceback objects are even not pickleable.
What is worse, some other non-special attributes are lost during pickling. For
example name and path attributes of ImportError.
>>> try: import foo
... except Exception as ex: exc = ex
...
>>> exc.name
'foo'
>>> exc.__reduce__()
(<class 'ModuleNotFoundError'>, ("No module named 'foo'",), {})
Or the value attribute of StopIteration if it was not passed to the constructor.
>>> exc = StopIteration()
>>> exc.value = 42
>>> exc.__reduce__()
(<class 'StopIteration'>, (), {})
----------
nosy: +brett.cannon, eric.snow, ncoghlan
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29466>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com