-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
doc: PyUnicode_AsUTF8String() fails if string contains surrogates #124605
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
I prefer to say "surrogate characters" rather than "lone surrogates", since surrogate pairs are also disallowed.
|
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.
See the surrogatepass error handler documentation:
+===================+========================+===========================================+
|``'surrogatepass'``| utf-8, utf-16, utf-32, | Allow encoding and decoding surrogate code|
| | utf-16-be, utf-16-le, | point (``U+D800`` - ``U+DFFF``) as normal |
| | utf-32-be, utf-32-le | code point. Otherwise these codecs treat |
| | | the presence of surrogate code point in |
| | | :class:`str` as an error. |
+-------------------+------------------------+-------------------------------------------+
I suggest to use term "surrogate code points" and specify the range.
Done. Please review my updated PR. |
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.
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…thonGH-124605) (cherry picked from commit d8cf587) Co-authored-by: Victor Stinner <vstinner@python.org>
Sorry, @vstinner, I could not cleanly backport this to
|
GH-124707 is a backport of this pull request to the 3.13 branch. |
📚 Documentation preview 📚: https://cpython-previews--124605.org.readthedocs.build/