Ben Bass <[email protected]> added the comment:
Perhaps this should be addressed separately, but subprocess.CalledProcessError
is subject to this problem (can't be unpickled) (it has separate returncode and
cmd attributes, but no args).
It's straightforward to conform user-defined Exceptions to including .args and
having reasonable __init__ functions, but not possible in the case of stdlib
exceptions.
>>> import subprocess, pickle
>>> try:
... subprocess.check_call('/bin/false')
... except Exception as e:
... pickle.loads(pickle.dumps(e))
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/lib/python3.1/subprocess.py", line 435, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/bin/false' returned non-zero exit
status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/usr/lib/python3.1/pickle.py", line 1363, in loads
encoding=encoding, errors=errors).load()
TypeError: __init__() takes at least 3 positional arguments (1 given)
----------
nosy: +bpb
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1692335>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com