]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39542: Declare _Py_AddToAllObjects() in pycore_object.h (GH-18368)
authorVictor Stinner <vstinner@python.org>
Wed, 5 Feb 2020 17:24:33 +0000 (18:24 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Feb 2020 17:24:33 +0000 (18:24 +0100)
_Py_AddToAllObjects() is used in bltinmodule.c and typeobject.c when
Py_TRACE_REFS is defined.

Fix Py_TRACE_REFS build.

Include/internal/pycore_object.h
Objects/object.c
Python/bltinmodule.c

index eac39c8a3fccc17477436ce865cf4ea686ca2b36..10a5746997ec72592e32e358c9f8dce254df8166 100644 (file)
@@ -82,6 +82,7 @@ extern void _PyDebug_PrintTotalRefs(void);
 #endif
 
 #ifdef Py_TRACE_REFS
+extern void _Py_AddToAllObjects(PyObject *op, int force);
 extern void _Py_PrintReferences(FILE *);
 extern void _Py_PrintReferenceAddresses(FILE *);
 #endif
index 43b838adff20cbbd9e04096f41869b5105492d33..9eaa163bdfd1f0c066f27127e8b7553d9db11be9 100644 (file)
@@ -93,7 +93,7 @@ static PyObject refchain = {&refchain, &refchain};
  * way, though; exceptions include statically allocated type objects, and
  * statically allocated singletons (like Py_True and Py_None).
  */
-static void
+void
 _Py_AddToAllObjects(PyObject *op, int force)
 {
 #ifdef  Py_DEBUG
index 5818eb9e38f6ad50ca76969051e47220466f8e66..cdb1eaaff01dea0c77047a7f24f64ef96cf0c8a9 100644 (file)
@@ -4,6 +4,7 @@
 #include <ctype.h>
 #include "ast.h"
 #undef Yield   /* undefine macro conflicting with <winbase.h> */
+#include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"
 #include "pycore_tupleobject.h"
@@ -2443,7 +2444,7 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
            would change the value of empty. In fact, using
            in-place addition rather that binary addition for
            any of the steps introduces subtle behavior changes:
-           
+
            https://bugs.python.org/issue18305 */
         temp = PyNumber_Add(result, item);
         Py_DECREF(result);