mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	gh-138342: Move _PyObject_VisitType() to the internal C API (#139734)
This commit is contained in:
		
							parent
							
								
									a15aeec29e
								
							
						
					
					
						commit
						c4e7d245d6
					
				
					 15 changed files with 35 additions and 11 deletions
				
			
		|  | @ -492,7 +492,3 @@ PyAPI_FUNC(int) PyUnstable_TryIncRef(PyObject *); | ||||||
| PyAPI_FUNC(void) PyUnstable_EnableTryIncRef(PyObject *); | PyAPI_FUNC(void) PyUnstable_EnableTryIncRef(PyObject *); | ||||||
| 
 | 
 | ||||||
| PyAPI_FUNC(int) PyUnstable_Object_IsUniquelyReferenced(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); |  | ||||||
|  |  | ||||||
|  | @ -1047,6 +1047,10 @@ static inline Py_ALWAYS_INLINE void _Py_INCREF_MORTAL(PyObject *op) | ||||||
| } | } | ||||||
| #endif | #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 | #ifdef __cplusplus | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #include "Python.h" | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
| 
 | 
 | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||||
|  |  | ||||||
|  | @ -30,9 +30,9 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include <Python.h> | #include <Python.h> | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
| #include "pycore_pystate.h"       // _PyThreadState_GET() | #include "pycore_pystate.h"       // _PyThreadState_GET() | ||||||
| #include "pycore_typeobject.h" | #include "pycore_typeobject.h" | ||||||
| #include "complexobject.h" |  | ||||||
| 
 | 
 | ||||||
| #include <mpdecimal.h> | #include <mpdecimal.h> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,11 +8,12 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #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 "gdbm.h" | ||||||
| 
 | 
 | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <stdlib.h>                 // free() | #include <stdlib.h>               // free() | ||||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,6 +8,7 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "multiprocessing.h" | #include "multiprocessing.h" | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_SYS_TIME_H | #ifdef HAVE_SYS_TIME_H | ||||||
| #  include <sys/time.h>           // gettimeofday()
 | #  include <sys/time.h>           // gettimeofday()
 | ||||||
|  |  | ||||||
|  | @ -21,8 +21,15 @@ | ||||||
|  * 3. This notice may not be removed or altered from any source distribution. |  * 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 "prepare_protocol.h" | ||||||
| 
 | 
 | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| static int | static int | ||||||
| pysqlite_prepare_protocol_init(PyObject *self, PyObject *args, PyObject *kwargs) | pysqlite_prepare_protocol_init(PyObject *self, PyObject *args, PyObject *kwargs) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -21,10 +21,17 @@ | ||||||
|  * 3. This notice may not be removed or altered from any source distribution. |  * 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 "connection.h" | ||||||
| #include "statement.h" | #include "statement.h" | ||||||
| #include "util.h" | #include "util.h" | ||||||
| 
 | 
 | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| #define _pysqlite_Statement_CAST(op)    ((pysqlite_Statement *)(op)) | #define _pysqlite_Statement_CAST(op)    ((pysqlite_Statement *)(op)) | ||||||
| 
 | 
 | ||||||
| /* prototypes */ | /* prototypes */ | ||||||
|  |  | ||||||
|  | @ -16,9 +16,10 @@ | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #include "Python.h" | ||||||
| #include "hashlib.h" | #include "hashlib.h" | ||||||
| #include "pycore_strhex.h"       // _Py_strhex() |  | ||||||
| #include "pycore_typeobject.h" |  | ||||||
| #include "pycore_moduleobject.h" | #include "pycore_moduleobject.h" | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
|  | #include "pycore_strhex.h"        // _Py_strhex() | ||||||
|  | #include "pycore_typeobject.h" | ||||||
| 
 | 
 | ||||||
| // QUICK CPU AUTODETECTION
 | // QUICK CPU AUTODETECTION
 | ||||||
| //
 | //
 | ||||||
|  |  | ||||||
|  | @ -22,7 +22,8 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #include "Python.h" | ||||||
| #include "pycore_strhex.h" // _Py_strhex() | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
|  | #include "pycore_strhex.h"        // _Py_strhex() | ||||||
| 
 | 
 | ||||||
| #include "hashlib.h" | #include "hashlib.h" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -21,6 +21,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #include "Python.h" | ||||||
| #include "hashlib.h" | #include "hashlib.h" | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
| #include "pycore_strhex.h"        // _Py_strhex() | #include "pycore_strhex.h"        // _Py_strhex() | ||||||
| #include "pycore_typeobject.h"    // _PyType_GetModuleState() | #include "pycore_typeobject.h"    // _PyType_GetModuleState() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -22,8 +22,9 @@ | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #include "Python.h" | ||||||
| #include "pycore_moduleobject.h"  // _PyModule_GetState() | #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_strhex.h"        // _Py_strhex() | ||||||
|  | #include "pycore_typeobject.h"    // _PyType_GetModuleState() | ||||||
| 
 | 
 | ||||||
| #include "hashlib.h" | #include "hashlib.h" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -21,6 +21,7 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #include "Python.h" | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
| #include "pycore_strhex.h"        // _Py_strhex() | #include "pycore_strhex.h"        // _Py_strhex() | ||||||
| #include "pycore_typeobject.h"    // _PyType_GetModuleState() | #include "pycore_typeobject.h"    // _PyType_GetModuleState() | ||||||
| #include "hashlib.h" | #include "hashlib.h" | ||||||
|  |  | ||||||
|  | @ -109,6 +109,7 @@ Local naming conventions: | ||||||
| #include "pycore_capsule.h"       // _PyCapsule_SetTraverse() | #include "pycore_capsule.h"       // _PyCapsule_SetTraverse() | ||||||
| #include "pycore_fileutils.h"     // _Py_set_inheritable() | #include "pycore_fileutils.h"     // _Py_set_inheritable() | ||||||
| #include "pycore_moduleobject.h"  // _PyModule_GetState | #include "pycore_moduleobject.h"  // _PyModule_GetState | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
| #include "pycore_time.h"          // _PyTime_AsMilliseconds() | #include "pycore_time.h"          // _PyTime_AsMilliseconds() | ||||||
| #include "pycore_pystate.h"       // _Py_AssertHoldsTstate() | #include "pycore_pystate.h"       // _Py_AssertHoldsTstate() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,6 +17,7 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #include "Python.h" | #include "Python.h" | ||||||
|  | #include "pycore_object.h"        // _PyObject_VisitType() | ||||||
| #include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI | #include "pycore_ucnhash.h"       // _PyUnicode_Name_CAPI | ||||||
| 
 | 
 | ||||||
| #include <stdbool.h> | #include <stdbool.h> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner