diff options
| author | Victor Stinner <vstinner@python.org> | 2022-05-03 20:47:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-03 20:47:29 +0200 |
| commit | ff3e9cdf334737aeedbbec2e5a219084d27db9cd (patch) | |
| tree | 2ad9f899f486c03929282a520cb0a6f538447132 /Include/cpython/weakrefobject.h | |
| parent | b270b82f1137ff25ee263eafd31503d760f3403d (diff) | |
| download | cpython-git-ff3e9cdf334737aeedbbec2e5a219084d27db9cd.tar.gz | |
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.
Diffstat (limited to 'Include/cpython/weakrefobject.h')
| -rw-r--r-- | Include/cpython/weakrefobject.h | 2 |
1 files changed, 1 insertions, 1 deletions
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, |
