mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-92135: Fix _Py_reinterpret_cast() for const (#92138)
Fix C++ compiler warnings on cast macros, like _PyObject_CAST(), when casting a constant expression to a non constant type: use const_cast<> in C++. * In C++, Py_SAFE_DOWNCAST() now uses static_cast<> rather than reinterpret_cast<>. * Add tests to the _testcppext C++ extension. * test_cppext no longer captures stdout in verbose mode.
This commit is contained in:
parent
b11243e85e
commit
031397063e
5 changed files with 62 additions and 14 deletions
|
@ -182,9 +182,9 @@ PyAPI_FUNC(void) PyObject_GC_UnTrack(void *);
|
|||
PyAPI_FUNC(void) PyObject_GC_Del(void *);
|
||||
|
||||
#define PyObject_GC_New(type, typeobj) \
|
||||
_Py_reinterpret_cast(type*, _PyObject_GC_New(typeobj))
|
||||
_Py_reinterpret_cast(type*, _PyObject_GC_New(typeobj))
|
||||
#define PyObject_GC_NewVar(type, typeobj, n) \
|
||||
_Py_reinterpret_cast(type*, _PyObject_GC_NewVar((typeobj), (n)))
|
||||
_Py_reinterpret_cast(type*, _PyObject_GC_NewVar((typeobj), (n)))
|
||||
|
||||
PyAPI_FUNC(int) PyObject_GC_IsTracked(PyObject *);
|
||||
PyAPI_FUNC(int) PyObject_GC_IsFinalized(PyObject *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue