[Python-checkins] gh-106320: Move _PyMethodWrapper_Type to internal C API (#107064)
vstinner
webhook-mailer at python.org
Sat Jul 22 16:58:03 EDT 2023
https://github.com/python/cpython/commit/ee15844db88fab3a282d14325662bcfd026272ac
commit: ee15844db88fab3a282d14325662bcfd026272ac
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2023-07-22T20:57:59Z
summary:
gh-106320: Move _PyMethodWrapper_Type to internal C API (#107064)
files:
M Include/cpython/descrobject.h
M Include/internal/pycore_descrobject.h
M Objects/descrobject.c
M Objects/object.c
M Python/specialize.c
diff --git a/Include/cpython/descrobject.h b/Include/cpython/descrobject.h
index e2ea1b9a2d305..bbad8b59c225a 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 76378569df90e..3cec59a68a3d2 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 810bd196e8f7e..74aa70bed7de9 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 93396bf5491d3..740d4a22c103b 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 dcf4be712db20..5892f5441c98e 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 <stdlib.h> // rand()
More information about the Python-checkins
mailing list