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.

Author yonghengzero
Recipients yonghengzero
Date 2021-09-06.10:14:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630923274.69.0.294387149834.issue45112@roundup.psfhosted.org>
In-reply-to
Content
Hi, when I'm trying to serialize/deserialize python exception object through pickle, I found that deserialize result is not the same as the original object...

My python version is 3.9.1, working os: macOS Big Sur 11.4

Here is minimum reproducing code example:

import pickle

class ExcA(Exception):
    def __init__(self, want):
        msg = "missing "
        msg += want
        super().__init__(msg)

ExcA('bb')   # this will output ExcA("missing bb"), which is good
pickle.loads(pickle.dumps(ExcA('bb')))  # this will output ExcA("missing missing bb"), which is different from `ExcA('bb')`
History
Date User Action Args
2021-09-06 10:14:34yonghengzerosetrecipients: + yonghengzero
2021-09-06 10:14:34yonghengzerosetmessageid: <1630923274.69.0.294387149834.issue45112@roundup.psfhosted.org>
2021-09-06 10:14:34yonghengzerolinkissue45112 messages
2021-09-06 10:14:34yonghengzerocreate