New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError.__init__ doesn't reset not specified exception attributes #72476
Comments
ImportError.__init__ sets only specified attributes ("msg", "name" or "path"), and left not explicitly specified attributes unchanged. >>> err = ImportError('test', name='name')
>>> err.args, err.msg, err.name, err.path
(('test',), 'test', 'name', None)
>>> err.__init__(path='path')
>>> err.args, err.msg, err.name, err.path
((), 'test', 'name', 'path') In above example err.__init__(path='path') sets attributes "args" and "path", but not "msg" and "name". I'm not sure whether can this be considered as a bug. |
I think it's a bug, but a low priority one. |
Here is a simple patch. But I'm not sure that this is a bug. |
Patch LGTM. |
And I say don't worry about backporting. |
Thanks Brett. |
New changeset dcb39d3ba67a by Serhiy Storchaka in branch 'default': |
Misc/NEWS
so that it is managed by towncrier #552Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: