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.

作者 bpb
收信人 alexandre.vassalotti, belopolsky, bpb, brett.cannon, ehuss, facundobatista, georg.brandl, gvanrossum, jafo, jaraco, jarpa, kylev, loewis, nnorwitz, tseaver, vstinner, zseil
日期 2011-04-12.13:52:51
SpamBayes Score 1.6350314e-09
Marked as misclassified
Message-id <1302616372.35.0.53865462248.issue1692335@psf.upfronthosting.co.za>
In-reply-to
内容
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)
历史
日期 用户 动作 参数
2011-04-12 13:52:52bpb修改recipients: + bpb, gvanrossum, loewis, nnorwitz, brett.cannon, georg.brandl, facundobatista, jafo, ehuss, tseaver, jaraco, belopolsky, zseil, vstinner, alexandre.vassalotti, jarpa, kylev
2011-04-12 13:52:52bpb修改messageid: <1302616372.35.0.53865462248.issue1692335@psf.upfronthosting.co.za>
2011-04-12 13:52:51bpb链接issue1692335 messages
2011-04-12 13:52:51bpb创建