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