[New-bugs-announce] [issue39919] C extension code reliant on static flags/behavior with PY_DEBUG (Py_SAFE_DOWNCAST, method flags) could potentially leverage _Static_assert

Enji Cooper report at bugs.python.org
Mon Mar 9 19:15:35 EDT 2020


New submission from Enji Cooper <yaneurabeya at gmail.com>:

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

----------
components: C API
messages: 363785
nosy: ngie
priority: normal
severity: normal
status: open
title: C extension code reliant on static flags/behavior with PY_DEBUG (Py_SAFE_DOWNCAST, method flags) could potentially leverage _Static_assert

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


More information about the New-bugs-announce mailing list