[New-bugs-announce] [issue45112] Python exception object is different after pickle.loads and pickle.dumps
Chen Zero
report at bugs.python.org
Mon Sep 6 06:14:34 EDT 2021
New submission from Chen Zero <yonghengzero at gmail.com>:
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')`
----------
files: screenshot.png
messages: 401128
nosy: yonghengzero
priority: normal
severity: normal
status: open
title: Python exception object is different after pickle.loads and pickle.dumps
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file50262/screenshot.png
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45112>
_______________________________________
More information about the New-bugs-announce
mailing list