This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ezio.melotti, methane, serhiy.storchaka, vstinner, yiyuaner
Date 2021-05-10.20:53:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620679997.89.0.0692208034996.issue44068@roundup.psfhosted.org>
In-reply-to
Content
> 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
History
Date User Action Args
2021-05-10 20:53:17vstinnersetrecipients: + vstinner, ezio.melotti, methane, serhiy.storchaka, yiyuaner
2021-05-10 20:53:17vstinnersetmessageid: <1620679997.89.0.0692208034996.issue44068@roundup.psfhosted.org>
2021-05-10 20:53:17vstinnerlinkissue44068 messages
2021-05-10 20:53:17vstinnercreate