| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
- `_Py*UnicodeObject_CAST` macros assert they have the right bits for the shape - `_PyUnicode_IsModifiable` & `_PyUnicodeWriter_CanWrite` assert that UTF-8 storage hasn't been allocated yet
| assert(!_Py_IsImmortal(buffer)); | ||
| assert(PyUnicode_IS_COMPACT_ASCII(buffer) | ||
| || _PyUnicode_UTF8(buffer) == NULL | ||
| || _PyUnicode_UTF8(buffer) == PyUnicode_DATA(buffer)); |
There was a problem hiding this comment.
I would prefer moving _PyUnicode_HAS_UTF8_MEMORY() static inline function to pycore_unicodeobject.h and just test:
assert(!_PyUnicode_HAS_UTF8_MEMORY(buffer);
Sorry, something went wrong.
Co-authored-by: Victor Stinner <vstinner@python.org>
|
Turns out I broke a private debug helper. Added a test so it doesn't happen again. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Add checks based on the review on #159028:
_Py*UnicodeObject_CAST macros assert they have the right bits for the shape
(this means that _PyUnicode_UTF8 asserts it's not called on a compact ASCII object.)
_PyUnicode_IsModifiable & _PyUnicodeWriter_CanWrite assert that UTF-8 storage hasn't been allocated yet
Move _PyUnicode_UTF8 to the internal header for use in _PyUnicodeWriter_CanWrite