66extern "C" {
77#endif
88
9- #ifndef Py_LIMITED_API
10- PyAPI_DATA (PyTypeObject ) _PyManagedBuffer_Type ;
11- #endif
129PyAPI_DATA (PyTypeObject ) PyMemoryView_Type ;
1310
1411#define PyMemoryView_Check (op ) Py_IS_TYPE((op), &PyMemoryView_Type)
1512
16- #ifndef Py_LIMITED_API
17- /* Get a pointer to the memoryview's private copy of the exporter's buffer. */
18- #define PyMemoryView_GET_BUFFER (op ) (&((PyMemoryViewObject *)(op))->view)
19- /* Get a pointer to the exporting object (this may be NULL!). */
20- #define PyMemoryView_GET_BASE (op ) (((PyMemoryViewObject *)(op))->view.obj)
21- #endif
22-
2313PyAPI_FUNC (PyObject * ) PyMemoryView_FromObject (PyObject * base );
2414#if !defined(Py_LIMITED_API ) || Py_LIMITED_API + 0 >= 0x03030000
2515PyAPI_FUNC (PyObject * ) PyMemoryView_FromMemory (char * mem , Py_ssize_t size ,
@@ -32,38 +22,10 @@ PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
3222 int buffertype ,
3323 char order );
3424
35-
36- /* The structs are declared here so that macros can work, but they shouldn't
37- be considered public. Don't access their fields directly, use the macros
38- and functions instead! */
3925#ifndef Py_LIMITED_API
40- #define _Py_MANAGED_BUFFER_RELEASED 0x001 /* access to exporter blocked */
41- #define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002 /* free format */
42- typedef struct {
43- PyObject_HEAD
44- int flags ; /* state flags */
45- Py_ssize_t exports ; /* number of direct memoryview exports */
46- Py_buffer master ; /* snapshot buffer obtained from the original exporter */
47- } _PyManagedBufferObject ;
48-
49-
50- /* memoryview state flags */
51- #define _Py_MEMORYVIEW_RELEASED 0x001 /* access to master buffer blocked */
52- #define _Py_MEMORYVIEW_C 0x002 /* C-contiguous layout */
53- #define _Py_MEMORYVIEW_FORTRAN 0x004 /* Fortran contiguous layout */
54- #define _Py_MEMORYVIEW_SCALAR 0x008 /* scalar: ndim = 0 */
55- #define _Py_MEMORYVIEW_PIL 0x010 /* PIL-style layout */
56-
57- typedef struct {
58- PyObject_VAR_HEAD
59- _PyManagedBufferObject * mbuf ; /* managed buffer */
60- Py_hash_t hash ; /* hash value for read-only views */
61- int flags ; /* state flags */
62- Py_ssize_t exports ; /* number of buffer re-exports */
63- Py_buffer view ; /* private copy of the exporter's view */
64- PyObject * weakreflist ;
65- Py_ssize_t ob_array [1 ]; /* shape, strides, suboffsets */
66- } PyMemoryViewObject ;
26+ # define Py_CPYTHON_MEMORYOBJECT_H
27+ # include "cpython/memoryobject.h"
28+ # undef Py_CPYTHON_MEMORYOBJECT_H
6729#endif
6830
6931#ifdef __cplusplus
0 commit comments