[issue45025] Reliance on C bit fields in C API is undefined behavior

STINNER Victor report at bugs.python.org
Mon Aug 30 11:03:16 EDT 2021


STINNER Victor <vstinner at python.org> added the comment:

> At least the PyASCIIObject struct in Include/cpython/unicodeobject.h uses bit fields. Various preprocessor macros like PyUnicode_IS_ASCII() and PyUnicode_KIND() access this struct's bit field.

What is your use case? Which functions do you need?

You should not access directly the PyASCIIObject structure. Python provides many functions to access the content of a Unicode string object.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45025>
_______________________________________


More information about the Python-bugs-list mailing list