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.

作者 slallum
收信人 alexandre.vassalotti, belopolsky, benjamin.peterson, bpb, brett.cannon, ehuss, facundobatista, fmitha, georg.brandl, gvanrossum, jafo, jaraco, jarpa, kylev, loewis, lukasz.langa, nnorwitz, pitrou, python-dev, sbt, slallum, taleinat, tseaver, vstinner, zbysz, zseil
日期 2018-01-28.11:43:18
SpamBayes Score -1.0
Marked as misclassified
Message-id <1517139798.73.0.467229070634.issue1692335@psf.upfronthosting.co.za>
In-reply-to
内容
Perhaps this is a problem for a different issue, but pickling custom exceptions fails when the exception gets more than one argument:

import pickle
class MultipleArgumentsError(Exception):
    def __init__(self, a, b):
        self.a = a
        self.b = b
        Exception.__init__(self, a)

pickle.loads(pickle.dumps(MultipleArgumentsError('a', 'b')))


this code produces the following error:

Traceback (most recent call last):
  File "/tmp/multiple_arguments_exception.py", line 8, in <module>
    pickle.loads(pickle.dumps(MultipleArgumentsError('a', 'b')))
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1388, in loads
    return Unpickler(file).load()
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1139, in load_reduce
    value = func(*args)
TypeError: __init__() takes exactly 3 arguments (2 given)
历史
日期 用户 动作 参数
2018-01-28 11:43:19slallum修改recipients: + slallum, gvanrossum, loewis, nnorwitz, brett.cannon, georg.brandl, facundobatista, jafo, ehuss, tseaver, jaraco, belopolsky, zseil, fmitha, pitrou, vstinner, taleinat, alexandre.vassalotti, benjamin.peterson, jarpa, bpb, zbysz, kylev, lukasz.langa, python-dev, sbt
2018-01-28 11:43:18slallum修改messageid: <1517139798.73.0.467229070634.issue1692335@psf.upfronthosting.co.za>
2018-01-28 11:43:18slallum链接issue1692335 messages
2018-01-28 11:43:18slallum创建