https://github.com/python/cpython/commit/1a082085ae3e3eb62fd8bfadbea3f1f526b551f6 commit: 1a082085ae3e3eb62fd8bfadbea3f1f526b551f6 branch: main author: Victor Stinner <vstin...@python.org> committer: vstinner <vstin...@python.org> date: 2025-03-21T16:44:10Z summary:
gh-131238: Remove pycore_object_deferred.h from pycore_object.h (#131549) Remove also pycore_function.h from pycore_typeobject.h. files: M Include/internal/pycore_interpframe.h M Include/internal/pycore_object.h M Include/internal/pycore_stackref.h M Include/internal/pycore_typeobject.h M Modules/_threadmodule.c M Objects/codeobject.c M Objects/descrobject.c M Objects/funcobject.c M Objects/moduleobject.c M Objects/obmalloc.c diff --git a/Include/internal/pycore_interpframe.h b/Include/internal/pycore_interpframe.h index 93d3469ce75ec3..f513dbe5cbbdb3 100644 --- a/Include/internal/pycore_interpframe.h +++ b/Include/internal/pycore_interpframe.h @@ -10,8 +10,9 @@ #endif #include "pycore_code.h" // _PyCode_CODE() -#include "pycore_structs.h" // _PyStackRef #include "pycore_stackref.h" // PyStackRef_AsPyObjectBorrow() +#include "pycore_stats.h" // CALL_STAT_INC() +#include "pycore_structs.h" // _PyStackRef #include "pycore_typedefs.h" // _PyInterpreterFrame diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 30b88404bbe204..5e900f5bb91c99 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -8,15 +8,17 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include <stdbool.h> #include "pycore_emscripten_trampoline.h" // _PyCFunction_TrampolineCall() -#include "pycore_object_deferred.h" // _PyObject_HasDeferredRefcount -#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_STORE_PTR_RELAXED +#include "pycore_gc.h" // _PyObject_GC_TRACK() +#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_LOAD_PTR_ACQUIRE() #include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_runtime.h" // _PyRuntime #include "pycore_typeobject.h" // _PyStaticType_GetState() #include "pycore_uniqueid.h" // _PyObject_ThreadIncrefSlow() +#include <stdbool.h> // bool + + // This value is added to `ob_ref_shared` for objects that use deferred // reference counting so that they are not immediately deallocated when the // non-deferred reference count drops to zero. diff --git a/Include/internal/pycore_stackref.h b/Include/internal/pycore_stackref.h index 9a9ec4be5b6ebf..cf7688416b170b 100644 --- a/Include/internal/pycore_stackref.h +++ b/Include/internal/pycore_stackref.h @@ -13,11 +13,11 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_object_deferred.h" -#include "pycore_object.h" +#include "pycore_object.h" // Py_DECREF_MORTAL +#include "pycore_object_deferred.h" // _PyObject_HasDeferredRefcount() + +#include <stdbool.h> // bool -#include <stddef.h> -#include <stdbool.h> /* This file introduces a new API for handling references on the stack, called diff --git a/Include/internal/pycore_typeobject.h b/Include/internal/pycore_typeobject.h index cd36400c0d3e95..1a4f89fd2449a0 100644 --- a/Include/internal/pycore_typeobject.h +++ b/Include/internal/pycore_typeobject.h @@ -8,10 +8,8 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#include "pycore_function.h" #include "pycore_interp_structs.h" // managed_static_type_state #include "pycore_moduleobject.h" // PyModuleObject -#include "pycore_stats.h" /* state */ diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index 53b2e685a577db..bcac2b48f18457 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -5,8 +5,9 @@ #include "pycore_fileutils.h" // _PyFile_Flush #include "pycore_interp.h" // _PyInterpreterState.threads.count #include "pycore_lock.h" -#include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_modsupport.h" // _PyArg_NoKeywords() +#include "pycore_moduleobject.h" // _PyModule_GetState() +#include "pycore_object_deferred.h" // _PyObject_SetDeferredRefcount() #include "pycore_pylifecycle.h" #include "pycore_pystate.h" // _PyThreadState_SetCurrent() #include "pycore_sysmodule.h" // _PySys_GetOptionalAttr() diff --git a/Objects/codeobject.c b/Objects/codeobject.c index 635da094e37a29..33505b40a7329f 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -2,6 +2,7 @@ #include "opcode.h" #include "pycore_code.h" // _PyCodeConstructor +#include "pycore_function.h" // _PyFunction_ClearCodeByVersion() #include "pycore_hashtable.h" // _Py_hashtable_t #include "pycore_index_pool.h" // _PyIndexPool_Fini() #include "pycore_initconfig.h" // _PyStatus_OK() diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 238becee241d1d..451e07f58e161e 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -8,6 +8,7 @@ #include "pycore_descrobject.h" // _PyMethodWrapper_Type #include "pycore_modsupport.h" // _PyArg_UnpackStack() #include "pycore_object.h" // _PyObject_GC_UNTRACK() +#include "pycore_object_deferred.h" // _PyObject_SetDeferredRefcount() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_tuple.h" // _PyTuple_ITEMS() diff --git a/Objects/funcobject.c b/Objects/funcobject.c index f5e519dad471e8..6d71dbb5a6affd 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -1,12 +1,12 @@ - /* Function object implementation */ #include "Python.h" -#include "pycore_dict.h" // _Py_INCREF_DICT() -#include "pycore_long.h" // _PyLong_GetOne() -#include "pycore_modsupport.h" // _PyArg_NoKeywords() -#include "pycore_object.h" // _PyObject_GC_UNTRACK() -#include "pycore_pyerrors.h" // _PyErr_Occurred() +#include "pycore_dict.h" // _Py_INCREF_DICT() +#include "pycore_function.h" // _PyFunction_Vectorcall +#include "pycore_long.h" // _PyLong_GetOne() +#include "pycore_modsupport.h" // _PyArg_NoKeywords() +#include "pycore_object.h" // _PyObject_GC_UNTRACK() +#include "pycore_pyerrors.h" // _PyErr_Occurred() #include "pycore_stats.h" diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 2412f994d4bf51..46dea1534cbcd6 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -1,4 +1,3 @@ - /* Module object implementation */ #include "Python.h" diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 189a673882dc78..be85a20c00dfea 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1,14 +1,14 @@ /* Python's malloc wrappers (see pymem.h) */ #include "Python.h" -#include "pycore_code.h" // stats #include "pycore_interp.h" // _PyInterpreterState_HasFeature #include "pycore_object.h" // _PyDebugAllocatorStats() definition #include "pycore_obmalloc.h" +#include "pycore_obmalloc_init.h" #include "pycore_pyerrors.h" // _Py_FatalErrorFormat() #include "pycore_pymem.h" #include "pycore_pystate.h" // _PyInterpreterState_GET -#include "pycore_obmalloc_init.h" +#include "pycore_stats.h" // OBJECT_STAT_INC_COND() #include <stdlib.h> // malloc() #include <stdbool.h> _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com