You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
In C++, Python 3.11 C API introduces new compiler warnings/errors #92135
To fix C++ compiler warnings about "old-style casts", I recently modified the Python C API to use C++ reinterpret_cast<> and static_cast<>: #91959
Previously, "old-style cast" like (PyObject*)expr didn't emit a compiler warning if expr was const. Now with the new cast, C++ compilers emit warnings: see #91959 (comment)
const_cast<> can be used to fix this issue.
Note: PEP 670 was accepted with the condition: converting macros to functions must not introduce new compiler warnings (so no new compile errors neither). But most functions modified in Python 3.11 (to use C++ casts) were already static inline functions in Python 3.10.
Activity
vstinner commentedon May 2, 2022
Documentation:
gh-92135: Fix _Py_reinterpret_cast() for const (#92138)
vstinner commentedon May 2, 2022
Fixed by #92138
gh-92135: Rename _Py_reinterpret_cast() to _Py_CAST() (#92230)
pythongh-92135: test_cppext requires subprocess
gh-92135: test_cppext requires subprocess (GH-92349)