]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40170: Move _Py_GetAllocatedBlocks() to pycore_pymem.h (GH-30943)
authorVictor Stinner <vstinner@python.org>
Thu, 27 Jan 2022 20:23:22 +0000 (21:23 +0100)
committerGitHub <noreply@github.com>
Thu, 27 Jan 2022 20:23:22 +0000 (21:23 +0100)
Move _Py_GetAllocatedBlocks() and _PyObject_DebugMallocStats()
declarations to pycore_pymem.h. These functions are related to memory
allocators, not to the PyObject structure.

Include/internal/pycore_object.h
Include/internal/pycore_pymem.h
Objects/obmalloc.c
Python/pylifecycle.c

index c520122aa579b9013c49a746d5f96e7e32589ddf..5fe4ddb2efbe1e87c20fe1f7903dd9e5bff3d622 100644 (file)
@@ -232,15 +232,6 @@ extern void _PyObject_FreeInstanceAttributes(PyObject *self);
 extern int _PyObject_IsInstanceDictEmpty(PyObject *);
 extern PyObject* _PyType_GetSubclasses(PyTypeObject *);
 
-/* This function returns the number of allocated memory blocks, regardless of size */
-PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
-
-/* Macros */
-#ifdef WITH_PYMALLOC
-// Export the symbol for the 3rd party guppy3 project
-PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out);
-#endif
-
 #ifdef __cplusplus
 }
 #endif
index d70deee710e30d40a539b3e6593729a0056d4a30..b9eea9d4b30ad16463c22afb97bafe0e12fd29cc 100644 (file)
@@ -99,6 +99,14 @@ PyAPI_DATA(struct _PyTraceMalloc_Config) _Py_tracemalloc_config;
 void *_PyObject_VirtualAlloc(size_t size);
 void _PyObject_VirtualFree(void *, size_t size);
 
+/* This function returns the number of allocated memory blocks, regardless of size */
+PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
+
+/* Macros */
+#ifdef WITH_PYMALLOC
+// Export the symbol for the 3rd party guppy3 project
+PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out);
+#endif
 
 #ifdef __cplusplus
 }
index ea0faff5bbe30d2ef6a65eff1c79bc9cc7319ed5..e3df7e8cc410ed6669fbf0fe546e23016bba01e6 100644 (file)
@@ -8,9 +8,6 @@
 /* Defined in tracemalloc.c */
 extern void _PyMem_DumpTraceback(int fd, const void *ptr);
 
-// Forward declaration
-int _PyObject_DebugMallocStats(FILE *out);
-
 
 /* Python's malloc wrappers (see pymem.h) */
 
index 106e11ea12ff533cf3388fd3ad98cfe335f91c2b..ba7bcd2f8899e4322e2eb2bcaaccf9b1fe07e52e 100644 (file)
@@ -19,6 +19,7 @@
 #include "pycore_pathconfig.h"    // _PyConfig_WritePathConfig()
 #include "pycore_pyerrors.h"      // _PyErr_Occurred()
 #include "pycore_pylifecycle.h"   // _PyErr_Print()
+#include "pycore_pymem.h"         // _PyObject_DebugMallocStats()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_runtime_init.h"  // _PyRuntimeState_INIT
 #include "pycore_sliceobject.h"   // _PySlice_Fini()