Message393431
> 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 |
|
Date |
User |
Action |
Args |
2021-05-10 20:53:17 | vstinner | set | recipients:
+ vstinner, ezio.melotti, methane, serhiy.storchaka, yiyuaner |
2021-05-10 20:53:17 | vstinner | set | messageid: <1620679997.89.0.0692208034996.issue44068@roundup.psfhosted.org> |
2021-05-10 20:53:17 | vstinner | link | issue44068 messages |
2021-05-10 20:53:17 | vstinner | create | |
|