summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-23 22:25:48 (GMT)
committerGitHub <noreply@github.com>2023-07-23 22:25:48 (GMT)
commit1e501122876f7e6abf979fdb756d7edd0d924ba1 (patch)
tree89700953efa188e82f9ef89bcc22bb1f8efed7c2 /Include
parent8de8a817ee81e352603380ddd1ae91accc99d4a9 (diff)
downloadcpython-1e501122876f7e6abf979fdb756d7edd0d924ba1.zip
cpython-1e501122876f7e6abf979fdb756d7edd0d924ba1.tar.gz
cpython-1e501122876f7e6abf979fdb756d7edd0d924ba1.tar.bz2
gh-106320: Remove private _PyObject C API (#107159)
Move private _PyObject and private _PyType functions to the internal C API (pycore_object.h): * _PyObject_GetMethod() * _PyObject_IsAbstract() * _PyObject_NextNotImplemented() * _PyType_CalculateMetaclass() * _PyType_GetDocFromInternalDoc() * _PyType_GetTextSignatureFromInternalDoc() No longer export these functions.
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/object.h12
-rw-r--r--Include/internal/pycore_object.h11
2 files changed, 10 insertions, 13 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index 90e45f6..fd45fa5 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -275,14 +275,6 @@ PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *);
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
PyAPI_FUNC(PyObject *) _PyType_LookupId(PyTypeObject *, _Py_Identifier *);
PyAPI_FUNC(PyObject *) _PyObject_LookupSpecialId(PyObject *, _Py_Identifier *);
-#ifndef Py_BUILD_CORE
-// Backward compatibility for 3rd-party extensions
-// that may be using the old name.
-#define _PyObject_LookupSpecial _PyObject_LookupSpecialId
-#endif
-PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *);
-PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *, const char *);
-PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *, const char *);
PyAPI_FUNC(PyObject *) PyType_GetModuleByDef(PyTypeObject *, PyModuleDef *);
PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *);
@@ -290,14 +282,10 @@ PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);
PyAPI_FUNC(void) _Py_BreakPoint(void);
PyAPI_FUNC(void) _PyObject_Dump(PyObject *);
-PyAPI_FUNC(int) _PyObject_IsAbstract(PyObject *);
PyAPI_FUNC(PyObject *) _PyObject_GetAttrId(PyObject *, _Py_Identifier *);
PyAPI_FUNC(int) _PyObject_SetAttrId(PyObject *, _Py_Identifier *, PyObject *);
-PyAPI_FUNC(int) _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
-
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *);
-PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *);
PyAPI_FUNC(void) PyObject_CallFinalizer(PyObject *);
PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *);
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 661820c..96aea47 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -376,7 +376,11 @@ static inline int _PyType_SUPPORTS_WEAKREFS(PyTypeObject *type) {
}
extern PyObject* _PyType_AllocNoTrack(PyTypeObject *type, Py_ssize_t nitems);
-PyObject *_PyType_NewManagedObject(PyTypeObject *type);
+extern PyObject *_PyType_NewManagedObject(PyTypeObject *type);
+
+extern PyTypeObject* _PyType_CalculateMetaclass(PyTypeObject *, PyObject *);
+extern PyObject* _PyType_GetDocFromInternalDoc(const char *, const char *);
+extern PyObject* _PyType_GetTextSignatureFromInternalDoc(const char *, const char *);
extern int _PyObject_InitializeDict(PyObject *obj);
int _PyObject_InitInlineValues(PyObject *obj, PyTypeObject *tp);
@@ -432,6 +436,11 @@ extern int _PyObject_IsInstanceDictEmpty(PyObject *);
PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, PyObject *);
+extern int _PyObject_IsAbstract(PyObject *);
+
+extern int _PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
+extern PyObject* _PyObject_NextNotImplemented(PyObject *);
+
/* C function call trampolines to mitigate bad function pointer casts.
*
* Typical native ABIs ignore additional arguments or fill in missing