| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Documentation build overview1 file changed ± c-api/unicode.html |
Sorry, something went wrong.
There was a problem hiding this comment.
It's a great idea to moving these functions to a dedicated function and write more details on conditions when using these functions is safe!
Sorry, something went wrong.
|
|
||
| - must not be hashed, | ||
| - must not be :c:func:`converted to UTF-8 <PyUnicode_AsUTF8AndSize>`, | ||
| or another non-"canonical" representation, |
There was a problem hiding this comment.
Currently, _PyUnicode_IsModifiable() returns 1 even if _PyUnicode_UTF8() is not NULL (for non-ASCII strings). Maybe it would be worth it return 0 in this case.
Note: For compact ASCII strings, _PyUnicode_UTF8() is always non-NULL.
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah. If you modify the string after the UTF-8 representation is cached, it'll get out of sync.
For compact ASCII strings, _PyUnicode_UTF8() has undefined behaviour. Maybe it wants an assert.
I filed #159033
Sorry, something went wrong.
There was a problem hiding this comment.
The details on conditions are just moved from the PyUnicode_New docs :)
Sorry, something went wrong.
|
|
||
| - must not be hashed, | ||
| - must not be :c:func:`converted to UTF-8 <PyUnicode_AsUTF8AndSize>`, | ||
| or another non-"canonical" representation, |
There was a problem hiding this comment.
Yeah. If you modify the string after the UTF-8 representation is cached, it'll get out of sync.
For compact ASCII strings, _PyUnicode_UTF8() has undefined behaviour. Maybe it wants an assert.
I filed #159033
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
I'm a little late to the party, but this seems worthwhile!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This moves documentation of the naughty functions to a new own section under the existing "Deprecated API", to de-emphasize them, and provide a common introduction (with links from each function).