-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-85287: Convert UnicodeError to UnicodeEncodeError| UnicodeDecodeError #21165
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
Conversation
…rror in idna.py, utf_16.py, utf_32.py, punycode.py, undefined.py modules.
@@ -1,4 +1,4 @@ | |||
""" Codec for the Punicode encoding, as specified in RFC 3492 | |||
""" Codec for the Punycode encoding, as specified in RFC 3492 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@pitrou Please review! |
The patch get the offsets in the exception object wrong for all non-trivial cases. For example the following case: >>> s = 'foo.' + 60*'\xff'
>>> s.encode('idna') gives the stack trace:
However the bad characters are not Fixing this would require to track the correct offset across multiple function calls. I'm not sure whether that added complexity is justified. |
A review by @doerwalter hasn't been being addressed for three years and the OP blocked their branch from external pushes thus preventing us from applying all necessary fixes by ourselves. |
https://bugs.python.org/issue41115