| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9b30784 commit fe9bed0
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,9 +8,9 @@ extern "C" { | |||
| 8 | 8 | #endif | |
| 9 | 9 | ||
| 10 | 10 | typedef struct { | |
| 11 | - PyObject_HEAD | ||
| 12 | - PyObject *base; | ||
| 13 | - Py_buffer view; | ||
| 11 | + PyObject_HEAD | ||
| 12 | + PyObject *base; | ||
| 13 | + Py_buffer view; | ||
| 14 | 14 | } PyMemoryViewObject; | |
| 15 | 15 | ||
| 16 | 16 | ||
@@ -21,39 +21,40 @@ PyAPI_DATA(PyTypeObject) PyMemoryView_Type; | |||
| 21 | 21 | ||
| 22 | 22 | #define Py_END_OF_MEMORY (-1) | |
| 23 | 23 | ||
| 24 | - PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, int buffertype, | ||
| 25 | - char fort); | ||
| 24 | + PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, | ||
| 25 | + int buffertype, | ||
| 26 | + char fort); | ||
| 26 | 27 | ||
| 27 | 28 | /* Return a contiguous chunk of memory representing the buffer | |
| 28 | 29 | from an object in a memory view object. If a copy is made then the | |
| 29 | - base object for the memory view will be a *new* bytes object. | ||
| 30 | - | ||
| 31 | - Otherwise, the base-object will be the object itself and no | ||
| 32 | - data-copying will be done. | ||
| 30 | + base object for the memory view will be a *new* bytes object. | ||
| 31 | + | ||
| 32 | + Otherwise, the base-object will be the object itself and no | ||
| 33 | + data-copying will be done. | ||
| 33 | 34 | ||
| 34 | - The buffertype argument can be PyBUF_READ, PyBUF_WRITE, | ||
| 35 | - PyBUF_UPDATEIFCOPY to determine whether the returned buffer | ||
| 36 | - should be READONLY, WRITABLE, or set to update the | ||
| 37 | - original buffer if a copy must be made. If buffertype is | ||
| 38 | - PyBUF_WRITE and the buffer is not contiguous an error will | ||
| 39 | - be raised. In this circumstance, the user can use | ||
| 40 | - PyBUF_UPDATEIFCOPY to ensure that a a writable temporary | ||
| 41 | - contiguous buffer is returned. The contents of this | ||
| 42 | - contiguous buffer will be copied back into the original | ||
| 43 | - object after the memoryview object is deleted as long as | ||
| 44 | - the original object is writable and allows setting its | ||
| 45 | - memory to "readonly". If this is not allowed by the | ||
| 46 | - original object, then a BufferError is raised. | ||
| 35 | + The buffertype argument can be PyBUF_READ, PyBUF_WRITE, | ||
| 36 | + PyBUF_SHADOW to determine whether the returned buffer | ||
| 37 | + should be READONLY, WRITABLE, or set to update the | ||
| 38 | + original buffer if a copy must be made. If buffertype is | ||
| 39 | + PyBUF_WRITE and the buffer is not contiguous an error will | ||
| 40 | + be raised. In this circumstance, the user can use | ||
| 41 | + PyBUF_SHADOW to ensure that a a writable temporary | ||
| 42 | + contiguous buffer is returned. The contents of this | ||
| 43 | + contiguous buffer will be copied back into the original | ||
| 44 | + object after the memoryview object is deleted as long as | ||
| 45 | + the original object is writable and allows setting an | ||
| 46 | + exclusive write lock. If this is not allowed by the | ||
| 47 | + original object, then a BufferError is raised. | ||
| 47 | 48 | ||
| 48 | - If the object is multi-dimensional and if fortran is 'F', | ||
| 49 | - the first dimension of the underlying array will vary the | ||
| 50 | - fastest in the buffer. If fortran is 'C', then the last | ||
| 51 | - dimension will vary the fastest (C-style contiguous). If | ||
| 52 | - fortran is 'A', then it does not matter and you will get | ||
| 53 | - whatever the object decides is more efficient. | ||
| 49 | + If the object is multi-dimensional and if fortran is 'F', | ||
| 50 | + the first dimension of the underlying array will vary the | ||
| 51 | + fastest in the buffer. If fortran is 'C', then the last | ||
| 52 | + dimension will vary the fastest (C-style contiguous). If | ||
| 53 | + fortran is 'A', then it does not matter and you will get | ||
| 54 | + whatever the object decides is more efficient. | ||
| 54 | 55 | ||
| 55 | - A new reference is returned that must be DECREF'd when finished. | ||
| 56 | - */ | ||
| 56 | + A new reference is returned that must be DECREF'd when finished. | ||
| 57 | + */ | ||
| 57 | 58 | ||
| 58 | 59 | PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); | |
| 59 | 60 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,7 +164,7 @@ typedef void (*releasebufferproc)(PyObject *, Py_buffer *); | |||
| 164 | 164 | #define PyBUF_WRITABLE 0x0002 | |
| 165 | 165 | /* we used to include an E, backwards compatible alias */ | |
| 166 | 166 | #define PyBUF_WRITEABLE PyBUF_WRITABLE | |
| 167 | - #define PyBUF_LOCKDATA 0x0004 | ||
| 167 | + #define PyBUF_LOCK 0x0004 | ||
| 168 | 168 | #define PyBUF_FORMAT 0x0008 | |
| 169 | 169 | #define PyBUF_ND 0x0010 | |
| 170 | 170 | #define PyBUF_STRIDES (0x0020 | PyBUF_ND) | |
@@ -175,19 +175,25 @@ typedef void (*releasebufferproc)(PyObject *, Py_buffer *); | |||
| 175 | 175 | ||
| 176 | 176 | #define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) | |
| 177 | 177 | #define PyBUF_CONTIG_RO (PyBUF_ND) | |
| 178 | - #define PyBUF_CONTIG_LCK (PyBUF_ND | PyBUF_LOCKDATA) | ||
| 178 | + #define PyBUF_CONTIG_LCK (PyBUF_ND | PyBUF_LOCK) | ||
| 179 | + #define PyBUF_CONTIG_XLCK (PyBUF_ND | PyBUF_LOCK | PyBUF_WRITABLE) | ||
| 179 | 180 | ||
| 180 | 181 | #define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) | |
| 181 | 182 | #define PyBUF_STRIDED_RO (PyBUF_STRIDES) | |
| 182 | - #define PyBUF_STRIDED_LCK (PyBUF_STRIDES | PyBUF_LOCKDATA) | ||
| 183 | + #define PyBUF_STRIDED_LCK (PyBUF_STRIDES | PyBUF_LOCK) | ||
| 184 | + #define PyBUF_STRIDED_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE) | ||
| 183 | 185 | ||
| 184 | 186 | #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) | |
| 185 | 187 | #define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) | |
| 186 | - #define PyBUF_RECORDS_LCK (PyBUF_STRIDES | PyBUF_LOCKDATA | PyBUF_FORMAT) | ||
| 188 | + #define PyBUF_RECORDS_LCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_FORMAT) | ||
| 189 | + #define PyBUF_RECORDS_XLCK (PyBUF_STRIDES | PyBUF_LOCK | PyBUF_WRITABLE \ | ||
| 190 | + | PyBUF_FORMAT) | ||
| 187 | 191 | ||
| 188 | 192 | #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) | |
| 189 | 193 | #define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) | |
| 190 | - #define PyBUF_FULL_LCK (PyBUF_INDIRECT | PyBUF_LOCKDATA | PyBUF_FORMAT) | ||
| 194 | + #define PyBUF_FULL_LCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_FORMAT) | ||
| 195 | + #define PyBUF_FULL_XLCK (PyBUF_INDIRECT | PyBUF_LOCK | PyBUF_WRITABLE \ | ||
| 196 | + | PyBUF_FORMAT) | ||
| 191 | 197 | ||
| 192 | 198 | ||
| 193 | 199 | #define PyBUF_READ 0x100 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments