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
repr() of ImportError misses keyword arguments name and path #74185
Comments
The repr of standard exceptions usually looks as exception constructor used for creating that exception. But the repr of ImportError misses keyword arguments name and path. >>> ImportError('test', name='somename', path='somepath')
ImportError('test',) Proposed patch make the repr of ImportError containing keyword arguments. >>> ImportError('test', name='somename', path='somepath')
ImportError('test', name='somename', path='somepath') I don't know how to classify this issue and whether the patch should be backported. |
I consider it an enhancement, especially if someone was slopping with their tests and explicitly checks the repr of ImportError. |
The patch also changes the repr of BaseException with a single argument. It no longer contains a trailing comma. |
Including 'path' may make the repr less readable in some cases. +1 for 'name', though. |
I think the issue steems from the more general bpo-27015 for which a PR is ready that fixes the repr not only for ImportError but all other BaseException subclasses that override __init__. |
The PRs need to be updated. Marking as easy. |
@iritkatriel PR updated by @arhadthedev I think PR is ready to merge. |
Note: 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: