[issue45112] Python exception object is different after pickle.dumps and pickle.loads

2021-09-06 Thread Chen Zero


Change by Chen Zero :


--
title: Python exception object is different after pickle.loads and pickle.dumps 
-> Python exception object is different after pickle.dumps and pickle.loads

___
Python tracker 
<https://bugs.python.org/issue45112>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45112] Python exception object is different after pickle.loads and pickle.dumps

2021-09-06 Thread Chen Zero


New submission from Chen Zero :

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 
<https://bugs.python.org/issue45112>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com