Skip to content

Commit 58f4e1a

Browse files
authored
bpo-39542: Declare _Py_AddToAllObjects() in pycore_object.h (GH-18368)
_Py_AddToAllObjects() is used in bltinmodule.c and typeobject.c when Py_TRACE_REFS is defined. Fix Py_TRACE_REFS build.
1 parent b39fb8e commit 58f4e1a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

‎Include/internal/pycore_object.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ extern void _PyDebug_PrintTotalRefs(void);
8282
#endif
8383

8484
#ifdef Py_TRACE_REFS
85+
extern void _Py_AddToAllObjects(PyObject *op, int force);
8586
extern void _Py_PrintReferences(FILE *);
8687
extern void _Py_PrintReferenceAddresses(FILE *);
8788
#endif

‎Objects/object.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static PyObject refchain = {&refchain, &refchain};
9393
* way, though; exceptions include statically allocated type objects, and
9494
* statically allocated singletons (like Py_True and Py_None).
9595
*/
96-
static void
96+
void
9797
_Py_AddToAllObjects(PyObject *op, int force)
9898
{
9999
#ifdef Py_DEBUG

‎Python/bltinmodule.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <ctype.h>
55
#include "ast.h"
66
#undef Yield /* undefine macro conflicting with <winbase.h> */
7+
#include "pycore_object.h"
78
#include "pycore_pyerrors.h"
89
#include "pycore_pystate.h"
910
#include "pycore_tupleobject.h"
@@ -2443,7 +2444,7 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
24432444
would change the value of empty. In fact, using
24442445
in-place addition rather that binary addition for
24452446
any of the steps introduces subtle behavior changes:
2446-
2447+
24472448
https://bugs.python.org/issue18305 */
24482449
temp = PyNumber_Add(result, item);
24492450
Py_DECREF(result);

0 commit comments

Comments
 (0)