classification
Title: Pickling and copying ImportError doesn't preserve name and path
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-04-05 20:34 by serhiy.storchaka, last changed 2017-04-08 08:28 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1010 merged serhiy.storchaka, 2017-04-05 20:39
PR 1042 merged serhiy.storchaka, 2017-04-08 07:06
PR 1043 merged serhiy.storchaka, 2017-04-08 07:07
Messages (4)
msg291194 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-05 20:34
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.
msg291324 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-08 06:55
New changeset b785396ab451b0c9d6ae9ee5a9e56c810209a6cb by Serhiy Storchaka in branch 'master':
bpo-29998: Pickling and copying ImportError now preserves name and path (#1010)
https://github.com/python/cpython/commit/b785396ab451b0c9d6ae9ee5a9e56c810209a6cb
msg291327 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-08 08:25
New changeset af685f9050416da8050e0ec11a8dff9afd4130e7 by Serhiy Storchaka in branch '3.6':
bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) (#1042)
https://github.com/python/cpython/commit/af685f9050416da8050e0ec11a8dff9afd4130e7
msg291328 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-08 08:26
New changeset e63f8f293a96ceebf06de15b4e1c97dbbff0f6a8 by Serhiy Storchaka in branch '3.5':
bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) (#1043)
https://github.com/python/cpython/commit/e63f8f293a96ceebf06de15b4e1c97dbbff0f6a8
History
Date User Action Args
2017-04-08 08:28:27serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-04-08 08:26:05serhiy.storchakasetmessages: + msg291328
2017-04-08 08:25:49serhiy.storchakasetmessages: + msg291327
2017-04-08 07:07:35serhiy.storchakasetpull_requests: + pull_request1196
2017-04-08 07:06:44serhiy.storchakasetpull_requests: + pull_request1195
2017-04-08 06:55:09serhiy.storchakasetmessages: + msg291324
2017-04-06 05:59:59serhiy.storchakalinkissue30005 dependencies
2017-04-05 20:39:54serhiy.storchakasetpull_requests: + pull_request1178
2017-04-05 20:34:36serhiy.storchakacreate