[issue29466] pickle does not serialize Exception __cause__ field

Irit Katriel report at bugs.python.org
Sun Jun 27 17:41:18 EDT 2021


Irit Katriel <iritkatriel at gmail.com> added the comment:

I get different output for Serhiy's first example now, but the same for the second:

>>> try: import foo
... except Exception as ex: exc = ex
... 
>>> exc.name
'foo'
>>> exc.__reduce__()
(<class 'ModuleNotFoundError'>, ("No module named 'foo'",), {'name': 'foo'})
>>> exc = StopIteration()
>>> exc.value = 42
>>> exc.__reduce__()
(<class 'StopIteration'>, ())
>>>

----------
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue29466>
_______________________________________


More information about the Python-bugs-list mailing list