From ff3e9cdf334737aeedbbec2e5a219084d27db9cd Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 3 May 2022 20:47:29 +0200 Subject: gh-91320: Fix more old-style cast warnings in C++ (#92247) Use _Py_CAST(), _Py_STATIC_CAST() and _PyASCIIObject_CAST() in static inline functions to fix C++ compiler warnings: "use of old-style cast" (clang -Wold-style-cast). test_cppext now builds the C++ test extension with -Wold-style-cast. --- Include/cpython/weakrefobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Include/cpython/weakrefobject.h') diff --git a/Include/cpython/weakrefobject.h b/Include/cpython/weakrefobject.h index 1078fffc2e..bec69ba90d 100644 --- a/Include/cpython/weakrefobject.h +++ b/Include/cpython/weakrefobject.h @@ -38,7 +38,7 @@ PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); static inline PyObject* PyWeakref_GET_OBJECT(PyObject *ref_obj) { assert(PyWeakref_Check(ref_obj)); - PyWeakReference *ref = (PyWeakReference *)ref_obj; + PyWeakReference *ref = _Py_CAST(PyWeakReference*, ref_obj); PyObject *obj = ref->wr_object; // Explanation for the Py_REFCNT() check: when a weakref's target is part // of a long chain of deallocations which triggers the trashcan mechanism, -- cgit v1.2.1