summaryrefslogtreecommitdiffstats
path: root/Include/methodobject.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-05-02 15:07:00 (GMT)
committerGitHub <noreply@github.com>2022-05-02 15:07:00 (GMT)
commit031397063e9c22711abfbf90f2617c8785cfc42c (patch)
tree08f64eeab6cbe6cebb51f44ddeb0f329c16ca9d3 /Include/methodobject.h
parentb11243e85e020ed2f524bdd83c339faf11ef03d4 (diff)
downloadcpython-031397063e9c22711abfbf90f2617c8785cfc42c.zip
cpython-031397063e9c22711abfbf90f2617c8785cfc42c.tar.gz
cpython-031397063e9c22711abfbf90f2617c8785cfc42c.tar.bz2
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.
Diffstat (limited to 'Include/methodobject.h')
-rw-r--r--Include/methodobject.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 2046ab9..f4be385 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -43,8 +43,7 @@ typedef PyObject *(*PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *,
// it triggers an undefined behavior when Python calls it with 2 parameters
// (bpo-33012).
#define _PyCFunction_CAST(func) \
- _Py_reinterpret_cast(PyCFunction, \
- _Py_reinterpret_cast(void(*)(void), (func)))
+ _Py_reinterpret_cast(PyCFunction, _Py_reinterpret_cast(void(*)(void), (func)))
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);