Closed
Description
Bug report
Say we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields should still be in-tact on the unpickled instance.
C:\Users\csm10495\Desktop>python
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
>>> a = AttributeError("test text", name="test name", obj="test obj")
>>> a.name
'test name'
>>> pickle.loads(pickle.dumps(a)).name
>>> pickle.loads(pickle.dumps(a))
AttributeError('test text')
Your environment
C:\Users\csm10495\Desktop>python --version
Python 3.11.0
C:\Users\csm10495\Desktop>ver
Microsoft Windows [Version 10.0.19045.2364]
C:\Users\csm10495\Desktop>
Same thing seems to happen on 3.10.7 and 3.11.3 as well.
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done