STINNER Victor <[email protected]> added the comment:
> Should we add an explicit check on variable char_size before using it in
> division?
Search for "There are 4 forms of Unicode strings" in
Include/cpython/unicodeobject.h. char_size cannot be 0 in resize_compact():
it's checked by 2 assertions:
assert(PyUnicode_IS_READY(unicode));
assert(PyUnicode_IS_COMPACT(unicode));
The function cannot be called on a string which is not compact.
There is no bug, I close the issue.
Hopefully, Inada-san will remove state.compact field in Python 3.12 with his
PEP 623!
https://www.python.org/dev/peps/pep-0623/#python-3-12
----------
nosy: +methane
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue44068>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com