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

STINNER Victor report at bugs.python.org
Mon Aug 30 11:26:43 EDT 2021


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

> In order to avoid undefined behavior, Python's C API should avoid all use of bit fields.

See also the PEP 620. IMO more generally, the C API should not expose structures, but provide ways to access it through getter and setter functions.

See bpo-40120 "Undefined C behavior going beyond end of struct via a [1] arrays" which is a similar issue.

----------

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


More information about the Python-bugs-list mailing list