gh-106320: Remove private _PyManagedBuffer_Type (#108431)

Remove private _PyManagedBuffer_Type variable. Move it to the
internal C API and no longer export it.
This commit is contained in:
Victor Stinner 2023-08-24 19:07:54 +02:00 committed by GitHub
parent c55e73112c
commit 773b803c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 3 deletions

View File

@ -2,8 +2,6 @@
# error "this header file must not be included directly" # error "this header file must not be included directly"
#endif #endif
PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type;
/* The structs are declared here so that macros can work, but they shouldn't /* The structs are declared here so that macros can work, but they shouldn't
be considered public. Don't access their fields directly, use the macros be considered public. Don't access their fields directly, use the macros
and functions instead! */ and functions instead! */

View File

@ -8,6 +8,8 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define" # error "this header requires Py_BUILD_CORE define"
#endif #endif
extern PyTypeObject _PyManagedBuffer_Type;
PyObject * PyObject *
_PyMemoryView_FromBufferProc(PyObject *v, int flags, _PyMemoryView_FromBufferProc(PyObject *v, int flags,
getbufferproc bufferproc); getbufferproc bufferproc);

View File

@ -12,6 +12,7 @@
#include "Python.h" #include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check() #include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_memoryobject.h" // _PyManagedBuffer_Type
#include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_object.h" // _PyObject_GC_UNTRACK()
#include "pycore_strhex.h" // _Py_strhex_with_sep() #include "pycore_strhex.h" // _Py_strhex_with_sep()
#include <stddef.h> // offsetof() #include <stddef.h> // offsetof()

View File

@ -9,15 +9,17 @@
#include "pycore_dict.h" // _PyObject_MakeDictFromInstanceAttributes() #include "pycore_dict.h" // _PyObject_MakeDictFromInstanceAttributes()
#include "pycore_floatobject.h" // _PyFloat_DebugMallocStats() #include "pycore_floatobject.h" // _PyFloat_DebugMallocStats()
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION() #include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
#include "pycore_memoryobject.h" // _PyManagedBuffer_Type
#include "pycore_namespace.h" // _PyNamespace_Type #include "pycore_namespace.h" // _PyNamespace_Type
#include "pycore_object.h" // PyAPI_DATA() _Py_SwappedOp definition #include "pycore_object.h" // PyAPI_DATA() _Py_SwappedOp definition
#include "pycore_pyerrors.h" // _PyErr_Occurred() #include "pycore_pyerrors.h" // _PyErr_Occurred()
#include "pycore_pymem.h" // _PyMem_IsPtrFreed() #include "pycore_pymem.h" // _PyMem_IsPtrFreed()
#include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_symtable.h" // PySTEntry_Type #include "pycore_symtable.h" // PySTEntry_Type
#include "pycore_typevarobject.h" // _PyTypeAlias_Type, _Py_initialize_generic
#include "pycore_typeobject.h" // _PyBufferWrapper_Type #include "pycore_typeobject.h" // _PyBufferWrapper_Type
#include "pycore_typevarobject.h" // _PyTypeAlias_Type, _Py_initialize_generic
#include "pycore_unionobject.h" // _PyUnion_Type #include "pycore_unionobject.h" // _PyUnion_Type
#include "interpreteridobject.h" // _PyInterpreterID_Type #include "interpreteridobject.h" // _PyInterpreterID_Type
#ifdef Py_LIMITED_API #ifdef Py_LIMITED_API