File indexing completed on 2025-01-18 10:06:41
0001 #ifndef Py_CPYTHON_MEMORYOBJECT_H
0002 # error "this header file must not be included directly"
0003 #endif
0004
0005 PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type;
0006
0007
0008
0009
0010 #define _Py_MANAGED_BUFFER_RELEASED 0x001
0011 #define _Py_MANAGED_BUFFER_FREE_FORMAT 0x002
0012
0013 typedef struct {
0014 PyObject_HEAD
0015 int flags;
0016 Py_ssize_t exports;
0017 Py_buffer master;
0018 } _PyManagedBufferObject;
0019
0020
0021
0022 #define _Py_MEMORYVIEW_RELEASED 0x001
0023 #define _Py_MEMORYVIEW_C 0x002
0024 #define _Py_MEMORYVIEW_FORTRAN 0x004
0025 #define _Py_MEMORYVIEW_SCALAR 0x008
0026 #define _Py_MEMORYVIEW_PIL 0x010
0027 #define _Py_MEMORYVIEW_RESTRICTED 0x020
0028
0029 typedef struct {
0030 PyObject_VAR_HEAD
0031 _PyManagedBufferObject *mbuf;
0032 Py_hash_t hash;
0033 int flags;
0034 Py_ssize_t exports;
0035 Py_buffer view;
0036 PyObject *weakreflist;
0037 Py_ssize_t ob_array[1];
0038 } PyMemoryViewObject;
0039
0040 #define _PyMemoryView_CAST(op) _Py_CAST(PyMemoryViewObject*, op)
0041
0042
0043 static inline Py_buffer* PyMemoryView_GET_BUFFER(PyObject *op) {
0044 return (&_PyMemoryView_CAST(op)->view);
0045 }
0046 #define PyMemoryView_GET_BUFFER(op) PyMemoryView_GET_BUFFER(_PyObject_CAST(op))
0047
0048
0049 static inline PyObject* PyMemoryView_GET_BASE(PyObject *op) {
0050 return _PyMemoryView_CAST(op)->view.obj;
0051 }
0052 #define PyMemoryView_GET_BASE(op) PyMemoryView_GET_BASE(_PyObject_CAST(op))