]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-138342: Move _PyObject_VisitType() to the internal C API (#139734)
authorVictor Stinner <vstinner@python.org>
Wed, 8 Oct 2025 10:10:58 +0000 (12:10 +0200)
committerGitHub <noreply@github.com>
Wed, 8 Oct 2025 10:10:58 +0000 (12:10 +0200)
15 files changed:
Include/cpython/object.h
Include/internal/pycore_object.h
Modules/_dbmmodule.c
Modules/_decimal/_decimal.c
Modules/_gdbmmodule.c
Modules/_multiprocessing/semaphore.c
Modules/_sqlite/prepare_protocol.c
Modules/_sqlite/statement.c
Modules/blake2module.c
Modules/md5module.c
Modules/sha1module.c
Modules/sha2module.c
Modules/sha3module.c
Modules/socketmodule.c
Modules/unicodedata.c

index 4e6f86f29d84730c7de11f1c94a91c2a37ffe892..e2f87524c218b6382ccd50b4df3e5b3bc0360190 100644 (file)
@@ -492,7 +492,3 @@ PyAPI_FUNC(int) PyUnstable_TryIncRef(PyObject *);
 PyAPI_FUNC(void) PyUnstable_EnableTryIncRef(PyObject *);
 
 PyAPI_FUNC(int) PyUnstable_Object_IsUniquelyReferenced(PyObject *);
-
-/* Utility for the tp_traverse slot of mutable heap types that have no other
- * references. */
-PyAPI_FUNC(int) _PyObject_VisitType(PyObject *op, visitproc visit, void *arg);
index 40f8ca68c00b72c91db5e51f518afc74227c9594..77560e5da66b03cf8bf407b93b1b0fafa160d69f 100644 (file)
@@ -1047,6 +1047,10 @@ static inline Py_ALWAYS_INLINE void _Py_INCREF_MORTAL(PyObject *op)
 }
 #endif
 
+/* Utility for the tp_traverse slot of mutable heap types that have no other
+ * references. */
+PyAPI_FUNC(int) _PyObject_VisitType(PyObject *op, visitproc visit, void *arg);
+
 #ifdef __cplusplus
 }
 #endif
index 3fdcf22ffd56d0b638667bfa2d18ef62cf75643f..06712015418cbccffb240b3e114525126962067d 100644 (file)
@@ -8,6 +8,7 @@
 #endif
 
 #include "Python.h"
+#include "pycore_object.h"        // _PyObject_VisitType()
 
 #include <sys/types.h>
 #include <sys/stat.h>
index 0696c150cd42fb34a6b31f29dd74ca119d2a84e1..04b6695f8af06a6087df24e8812c785ab63e3cd1 100644 (file)
@@ -30,9 +30,9 @@
 #endif
 
 #include <Python.h>
+#include "pycore_object.h"        // _PyObject_VisitType()
 #include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_typeobject.h"
-#include "complexobject.h"
 
 #include <mpdecimal.h>
 
index a4bc0a0f675530625fb593dfd34d214c6ccf789b..87b84976f49d61a10e8110837513fb94db54b606 100644 (file)
@@ -8,11 +8,12 @@
 #endif
 
 #include "Python.h"
-#include "pycore_pyerrors.h"        // _PyErr_SetLocaleString()
+#include "pycore_object.h"        // _PyObject_VisitType()
+#include "pycore_pyerrors.h"      // _PyErr_SetLocaleString()
 #include "gdbm.h"
 
 #include <fcntl.h>
-#include <stdlib.h>                 // free()
+#include <stdlib.h>               // free()
 #include <sys/stat.h>
 #include <sys/types.h>
 
index d5a1f27e9ff4ff780e6d9ec5bb212b9ae1ed7168..85cc0ac70a6563935c09a6c728a15e30d7c08377 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "multiprocessing.h"
+#include "pycore_object.h"        // _PyObject_VisitType()
 
 #ifdef HAVE_SYS_TIME_H
 #  include <sys/time.h>           // gettimeofday()
index d7ac09e3947a77ab4b42074155e7024586148bce..0e2812e1e4ffa80ba3b9d78e1c8a05055f6af1df 100644 (file)
  * 3. This notice may not be removed or altered from any source distribution.
  */
 
+#ifndef Py_BUILD_CORE_BUILTIN
+#  define Py_BUILD_CORE_MODULE 1
+#endif
+
 #include "prepare_protocol.h"
 
+#include "pycore_object.h"        // _PyObject_VisitType()
+
+
 static int
 pysqlite_prepare_protocol_init(PyObject *self, PyObject *args, PyObject *kwargs)
 {
index 77181104eda10b8bca705559fa968136e72af73b..c551ca59b3381ff6fa36c9581722fa912c69f884 100644 (file)
  * 3. This notice may not be removed or altered from any source distribution.
  */
 
+#ifndef Py_BUILD_CORE_BUILTIN
+#  define Py_BUILD_CORE_MODULE 1
+#endif
+
 #include "connection.h"
 #include "statement.h"
 #include "util.h"
 
+#include "pycore_object.h"        // _PyObject_VisitType()
+
+
 #define _pysqlite_Statement_CAST(op)    ((pysqlite_Statement *)(op))
 
 /* prototypes */
index 4921e8f945ef3794e87b34e9fd5e631da9c6da33..89b0ebd516f693259362fa8a313e2932c9f7dda5 100644 (file)
 
 #include "Python.h"
 #include "hashlib.h"
-#include "pycore_strhex.h"       // _Py_strhex()
-#include "pycore_typeobject.h"
 #include "pycore_moduleobject.h"
+#include "pycore_object.h"        // _PyObject_VisitType()
+#include "pycore_strhex.h"        // _Py_strhex()
+#include "pycore_typeobject.h"
 
 // QUICK CPU AUTODETECTION
 //
index 6b6457427b6b5ea1a1f0e8c4d7abfd20df6686a2..56e9faf4c62002899777975c53876ca6581c4212 100644 (file)
@@ -22,7 +22,8 @@
 #endif
 
 #include "Python.h"
-#include "pycore_strhex.h" // _Py_strhex()
+#include "pycore_object.h"        // _PyObject_VisitType()
+#include "pycore_strhex.h"        // _Py_strhex()
 
 #include "hashlib.h"
 
index d64eb91458cae819b2307790ace3bc52b42ad4d7..89e66240d1d11f443e702aef3fbacddfab871f9d 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "Python.h"
 #include "hashlib.h"
+#include "pycore_object.h"        // _PyObject_VisitType()
 #include "pycore_strhex.h"        // _Py_strhex()
 #include "pycore_typeobject.h"    // _PyType_GetModuleState()
 
index 66259fe47a0fd35c9a76bd1b050a2b9b7c0f62e7..9453b0be512555b9e6669d57bd0ae9765792acb1 100644 (file)
@@ -22,8 +22,9 @@
 
 #include "Python.h"
 #include "pycore_moduleobject.h"  // _PyModule_GetState()
-#include "pycore_typeobject.h"    // _PyType_GetModuleState()
+#include "pycore_object.h"        // _PyObject_VisitType()
 #include "pycore_strhex.h"        // _Py_strhex()
+#include "pycore_typeobject.h"    // _PyType_GetModuleState()
 
 #include "hashlib.h"
 
index 14c543b86415d5d28c9be29251345fc208482f88..38c9bc0405be60726b72101c16cb8d50f566c01b 100644 (file)
@@ -21,6 +21,7 @@
 #endif
 
 #include "Python.h"
+#include "pycore_object.h"        // _PyObject_VisitType()
 #include "pycore_strhex.h"        // _Py_strhex()
 #include "pycore_typeobject.h"    // _PyType_GetModuleState()
 #include "hashlib.h"
index ec8b53273bc0830004571b1b28e8648f5f8131cd..fa153efd8b72ec043565b49c74e59d0114e4146f 100644 (file)
@@ -109,6 +109,7 @@ Local naming conventions:
 #include "pycore_capsule.h"       // _PyCapsule_SetTraverse()
 #include "pycore_fileutils.h"     // _Py_set_inheritable()
 #include "pycore_moduleobject.h"  // _PyModule_GetState
+#include "pycore_object.h"        // _PyObject_VisitType()
 #include "pycore_time.h"          // _PyTime_AsMilliseconds()
 #include "pycore_pystate.h"       // _Py_AssertHoldsTstate()
 
index 3c9bc35fa35c8fc7cea9db8481b02cdb9617403e..a3699beff7da0171d484e3caa74092f09e7033a0 100644 (file)
@@ -17,6 +17,7 @@
 #endif
 
 #include "Python.h"
+#include "pycore_object.h"        // _PyObject_VisitType()
 #include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI
 
 #include <stdbool.h>