mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
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.
This commit is contained in:
parent
b270b82f11
commit
ff3e9cdf33
3 changed files with 19 additions and 16 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue