From a9426dbcb21b9b90568484c4292093bf64afeaa1 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 22 Jul 2023 22:30:32 +0200 Subject: [PATCH] gh-106320: Move _PyMethodWrapper_Type to internal C API --- Include/cpython/descrobject.h | 2 -- Include/internal/pycore_descrobject.h | 2 ++ Objects/descrobject.c | 2 +- Objects/object.c | 1 + Python/specialize.c | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Include/cpython/descrobject.h b/Include/cpython/descrobject.h index e2ea1b9a2d3058..bbad8b59c225ab 100644 --- a/Include/cpython/descrobject.h +++ b/Include/cpython/descrobject.h @@ -57,8 +57,6 @@ typedef struct { void *d_wrapped; /* This can be any function pointer */ } PyWrapperDescrObject; -PyAPI_DATA(PyTypeObject) _PyMethodWrapper_Type; - PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); PyAPI_FUNC(int) PyDescr_IsData(PyObject *); diff --git a/Include/internal/pycore_descrobject.h b/Include/internal/pycore_descrobject.h index 76378569df90e3..3cec59a68a3d2b 100644 --- a/Include/internal/pycore_descrobject.h +++ b/Include/internal/pycore_descrobject.h @@ -20,6 +20,8 @@ typedef struct { typedef propertyobject _PyPropertyObject; +extern PyTypeObject _PyMethodWrapper_Type; + #ifdef __cplusplus } #endif diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 810bd196e8f7e7..74aa70bed7de98 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -4,11 +4,11 @@ #include "pycore_abstract.h" // _PyObject_RealIsSubclass() #include "pycore_call.h" // _PyStack_AsDict() #include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate() +#include "pycore_descrobject.h" // _PyMethodWrapper_Type #include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_tuple.h" // _PyTuple_ITEMS() #include "structmember.h" // PyMemberDef -#include "pycore_descrobject.h" /*[clinic input] class mappingproxy "mappingproxyobject *" "&PyDictProxy_Type" diff --git a/Objects/object.c b/Objects/object.c index 93396bf5491d35..740d4a22c103b2 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -5,6 +5,7 @@ #include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate() #include "pycore_context.h" // _PyContextTokenMissing_Type +#include "pycore_descrobject.h" // _PyMethodWrapper_Type #include "pycore_dict.h" // _PyObject_MakeDictFromInstanceAttributes() #include "pycore_floatobject.h" // _PyFloat_DebugMallocStats() #include "pycore_initconfig.h" // _PyStatus_EXCEPTION() diff --git a/Python/specialize.c b/Python/specialize.c index dcf4be712db20d..5892f5441c98e2 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -1,5 +1,6 @@ #include "Python.h" #include "pycore_code.h" +#include "pycore_descrobject.h" // _PyMethodWrapper_Type #include "pycore_dict.h" #include "pycore_function.h" // _PyFunction_GetVersionForCurrentState() #include "pycore_global_strings.h" // _Py_ID() @@ -7,9 +8,8 @@ #include "pycore_moduleobject.h" #include "pycore_object.h" #include "pycore_opcode.h" // _PyOpcode_Caches -#include "structmember.h" // struct PyMemberDef, T_OFFSET_EX -#include "pycore_descrobject.h" #include "pycore_pylifecycle.h" // _PyOS_URandomNonblock() +#include "structmember.h" // struct PyMemberDef, T_OFFSET_EX #include // rand()