This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020年09月12日 00:17 by Anthony Sottile, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg376754 - (view) | Author: Anthony Sottile (Anthony Sottile) * | Date: 2020年09月12日 00:17 | |
For example:
>>> import pwd
>>> pwd.getpwnam("test")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: "getpwnam(): name not found: 'test'"
An improvement would be something which doesn't have the extra set of quotes such as:
>>> import pwd
>>> pwd.getpwnam("test")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: getpwnam(): name not found: 'test'
I understand this is due to the `KeyError` repr, I wonder if something could be done to improve this (maybe a subclass of KeyError? maybe a new optional named-only argument to KeyError?)
Seems there are others which could be improved here as well:
>>> import unicodedata
>>> unicodedata.lookup('zzz')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: "undefined character name 'zzz'"
|
|||
| msg376762 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2020年09月12日 01:57 | |
Perhaps a duplicate of Issue 2651, closed because it was too hard to fix without breaking compatibility. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:35 | admin | set | github: 85933 |
| 2020年09月12日 02:10:38 | Anthony Sottile | set | status: open -> closed stage: resolved |
| 2020年09月12日 01:57:05 | martin.panter | set | superseder: Strings passed to KeyError do not round trip messages: + msg376762 nosy: + martin.panter |
| 2020年09月12日 00:17:04 | Anthony Sottile | create | |