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.

classification
Title: C extension code reliant on static flags/behavior with PY_DEBUG (Py_SAFE_DOWNCAST, method flags) could potentially leverage _Static_assert
Type: Stage:
Components: C API Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ngie
Priority: normal Keywords:

Created on 2020-03-09 23:15 by ngie, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg363785 - (view) Author: Enji Cooper (ngie) * Date: 2020-03-09 23:15
Looking at Py_SAFE_DOWNCAST, it seems that the code could (in theory) leverage _Static_assert on C11 capable compilers [1].

Looking at some other code APIs, like module initialization with METH_VARARGS, etc, there are ways to determine whether or not the values are valid at compile-time with C11 capable compilers, instead of figuring out the issues on the tail end at runtime and having to play whackamole figuring out which offending methods are triggering issues (see also: bpo-39884).

1. https://en.cppreference.com/w/c/language/_Static_assert
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 84100
2020-03-09 23:15:34ngiecreate