Skip to content

Commit 773b803

Browse files
authored
gh-106320: Remove private _PyManagedBuffer_Type (#108431)
Remove private _PyManagedBuffer_Type variable. Move it to the internal C API and no longer export it.
1 parent c55e731 commit 773b803

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

Include/cpython/memoryobject.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# error "this header file must not be included directly"
33
#endif
44

5-
PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type;
6-
75
/* The structs are declared here so that macros can work, but they shouldn't
86
be considered public. Don't access their fields directly, use the macros
97
and functions instead! */

Include/internal/pycore_memoryobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11+
extern PyTypeObject _PyManagedBuffer_Type;
12+
1113
PyObject *
1214
_PyMemoryView_FromBufferProc(PyObject *v, int flags,
1315
getbufferproc bufferproc);

Objects/memoryobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "Python.h"
1414
#include "pycore_abstract.h" // _PyIndex_Check()
15+
#include "pycore_memoryobject.h" // _PyManagedBuffer_Type
1516
#include "pycore_object.h" // _PyObject_GC_UNTRACK()
1617
#include "pycore_strhex.h" // _Py_strhex_with_sep()
1718
#include <stddef.h> // offsetof()

Objects/object.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
#include "pycore_dict.h" // _PyObject_MakeDictFromInstanceAttributes()
1010
#include "pycore_floatobject.h" // _PyFloat_DebugMallocStats()
1111
#include "pycore_initconfig.h" // _PyStatus_EXCEPTION()
12+
#include "pycore_memoryobject.h" // _PyManagedBuffer_Type
1213
#include "pycore_namespace.h" // _PyNamespace_Type
1314
#include "pycore_object.h" // PyAPI_DATA() _Py_SwappedOp definition
1415
#include "pycore_pyerrors.h" // _PyErr_Occurred()
1516
#include "pycore_pymem.h" // _PyMem_IsPtrFreed()
1617
#include "pycore_pystate.h" // _PyThreadState_GET()
1718
#include "pycore_symtable.h" // PySTEntry_Type
18-
#include "pycore_typevarobject.h" // _PyTypeAlias_Type, _Py_initialize_generic
1919
#include "pycore_typeobject.h" // _PyBufferWrapper_Type
20+
#include "pycore_typevarobject.h" // _PyTypeAlias_Type, _Py_initialize_generic
2021
#include "pycore_unionobject.h" // _PyUnion_Type
22+
2123
#include "interpreteridobject.h" // _PyInterpreterID_Type
2224

2325
#ifdef Py_LIMITED_API

0 commit comments

Comments
 (0)