]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110481: fix 'unused function' warning for `is_shared_refcnt_dead`. (gh-111974)
authorSam Gross <colesbury@gmail.com>
Fri, 10 Nov 2023 23:54:35 +0000 (18:54 -0500)
committerGitHub <noreply@github.com>
Fri, 10 Nov 2023 23:54:35 +0000 (08:54 +0900)
Fix 'unused function' warning for `is_shared_refcnt_dead`.

The `is_shared_refcnt_dead` function is only used if `Py_REF_DEBUG` is set.

Objects/object.c

index b7662783a061a96fce8d13c4921fdb5e13d0a9e2..1003029f0ed722168e695f749f831e9e1fb7eb4f 100644 (file)
@@ -297,15 +297,17 @@ _Py_DecRef(PyObject *o)
 }
 
 #ifdef Py_NOGIL
+# ifdef Py_REF_DEBUG
 static inline int
 is_shared_refcnt_dead(Py_ssize_t shared)
 {
-#if SIZEOF_SIZE_T == 8
+#  if SIZEOF_SIZE_T == 8
     return shared == (Py_ssize_t)0xDDDDDDDDDDDDDDDD;
-#else
+#  else
     return shared == (Py_ssize_t)0xDDDDDDDD;
-#endif
+#  endif
 }
+# endif
 
 void
 _Py_DecRefSharedDebug(PyObject *o, const char *filename, int lineno)
@@ -412,7 +414,7 @@ _Py_ExplicitMergeRefcount(PyObject *op, Py_ssize_t extra)
     _Py_atomic_store_uintptr_relaxed(&op->ob_tid, 0);
     return refcnt;
 }
-#endif
+#endif  /* Py_NOGIL */
 
 
 /**************************************/