◐ Shell
clean mode source ↗

Issue 29998: Pickling and copying ImportError doesn't preserve name and path

Pickling and copying ImportError doesn't preserve name and path attributes.

>>> import copy, pickle
>>> e = ImportError('test', name='n', path='p')
>>> e.name
'n'
>>> e.path
'p'
>>> e2 = pickle.loads(pickle.dumps(e, 4))
>>> e2.name
>>> e2.path
>>> e2 = copy.copy(e)
>>> e2.name
>>> e2.path

Proposed patch fixes this.