diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /contrib/tools/cython/Cython/Includes/cpython/buffer.pxd | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Includes/cpython/buffer.pxd')
-rw-r--r-- | contrib/tools/cython/Cython/Includes/cpython/buffer.pxd | 216 |
1 files changed, 108 insertions, 108 deletions
diff --git a/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd b/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd index 3f1ada774a..82c0ced9df 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd @@ -1,112 +1,112 @@ -# Please see the Python header files (object.h/abstract.h) for docs - -cdef extern from "Python.h": - - cdef enum: +# Please see the Python header files (object.h/abstract.h) for docs + +cdef extern from "Python.h": + + cdef enum: PyBUF_MAX_NDIM cdef enum: - PyBUF_SIMPLE, - PyBUF_WRITABLE, + PyBUF_SIMPLE, + PyBUF_WRITABLE, PyBUF_WRITEABLE, # backwards compatibility - PyBUF_FORMAT, - PyBUF_ND, - PyBUF_STRIDES, - PyBUF_C_CONTIGUOUS, - PyBUF_F_CONTIGUOUS, - PyBUF_ANY_CONTIGUOUS, - PyBUF_INDIRECT, - PyBUF_CONTIG, - PyBUF_CONTIG_RO, - PyBUF_STRIDED, - PyBUF_STRIDED_RO, - PyBUF_RECORDS, - PyBUF_RECORDS_RO, - PyBUF_FULL, - PyBUF_FULL_RO, - PyBUF_READ, - PyBUF_WRITE, - PyBUF_SHADOW - - bint PyObject_CheckBuffer(object obj) - # Return 1 if obj supports the buffer interface otherwise 0. - - int PyObject_GetBuffer(object obj, Py_buffer *view, int flags) except -1 - # Export obj into a Py_buffer, view. These arguments must never be - # NULL. The flags argument is a bit field indicating what kind of - # buffer the caller is prepared to deal with and therefore what - # kind of buffer the exporter is allowed to return. The buffer - # interface allows for complicated memory sharing possibilities, - # but some caller may not be able to handle all the complexity but - # may want to see if the exporter will let them take a simpler - # view to its memory. - - # Some exporters may not be able to share memory in every possible - # way and may need to raise errors to signal to some consumers - # that something is just not possible. These errors should be a - # BufferError unless there is another error that is actually - # causing the problem. The exporter can use flags information to - # simplify how much of the Py_buffer structure is filled in with - # non-default values and/or raise an error if the object can’t - # support a simpler view of its memory. - - # 0 is returned on success and -1 on error. - - void PyBuffer_Release(Py_buffer *view) - # Release the buffer view. This should be called when the buffer - # is no longer being used as it may free memory from it. - - void* PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices) - # ?? - - Py_ssize_t PyBuffer_SizeFromFormat(char *) # actually const char - # Return the implied ~Py_buffer.itemsize from the struct-stype - # ~Py_buffer.format - - int PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort) - # ?? - - int PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort) - # ?? - - int PyObject_CopyToObject(object obj, void *buf, Py_ssize_t len, char fortran) except -1 - # Copy len bytes of data pointed to by the contiguous chunk of - # memory pointed to by buf into the buffer exported by obj. The - # buffer must of course be writable. Return 0 on success and - # return -1 and raise an error on failure. If the object does not - # have a writable buffer, then an error is raised. If fortran is - # 'F', then if the object is multi-dimensional, then the data will - # be copied into the array in Fortran-style (first dimension - # varies the fastest). If fortran is 'C', then the data will be - # copied into the array in C-style (last dimension varies the - # fastest). If fortran is 'A', then it does not matter and the - # copy will be made in whatever way is more efficient. - - int PyObject_CopyData(object dest, object src) except -1 - # Copy the data from the src buffer to the buffer of destination - - bint PyBuffer_IsContiguous(Py_buffer *view, char fort) - # Return 1 if the memory defined by the view is C-style (fortran - # is 'C') or Fortran-style (fortran is 'F') contiguous or either - # one (fortran is 'A'). Return 0 otherwise. - - void PyBuffer_FillContiguousStrides(int ndims, - Py_ssize_t *shape, - Py_ssize_t *strides, - Py_ssize_t itemsize, - char fort) - # Fill the strides array with byte-strides of a contiguous - # (Fortran-style if fort is 'F' or C-style otherwise) array of the - # given shape with the given number of bytes per element. - - int PyBuffer_FillInfo(Py_buffer *view, object exporter, void *buf, - Py_ssize_t len, int readonly, int flags) except -1 - # Fill in a buffer-info structure, view, correctly for an exporter - # that can only share a contiguous chunk of memory of “unsigned - # bytes” of the given length. Return 0 on success and -1 (with - # raising an error) on error. - - # DEPRECATED HERE: do not cimport from here, cimport from cpython.object instead - object PyObject_Format(object obj, object format_spec) - # Takes an arbitrary object and returns the result of calling - # obj.__format__(format_spec). + PyBUF_FORMAT, + PyBUF_ND, + PyBUF_STRIDES, + PyBUF_C_CONTIGUOUS, + PyBUF_F_CONTIGUOUS, + PyBUF_ANY_CONTIGUOUS, + PyBUF_INDIRECT, + PyBUF_CONTIG, + PyBUF_CONTIG_RO, + PyBUF_STRIDED, + PyBUF_STRIDED_RO, + PyBUF_RECORDS, + PyBUF_RECORDS_RO, + PyBUF_FULL, + PyBUF_FULL_RO, + PyBUF_READ, + PyBUF_WRITE, + PyBUF_SHADOW + + bint PyObject_CheckBuffer(object obj) + # Return 1 if obj supports the buffer interface otherwise 0. + + int PyObject_GetBuffer(object obj, Py_buffer *view, int flags) except -1 + # Export obj into a Py_buffer, view. These arguments must never be + # NULL. The flags argument is a bit field indicating what kind of + # buffer the caller is prepared to deal with and therefore what + # kind of buffer the exporter is allowed to return. The buffer + # interface allows for complicated memory sharing possibilities, + # but some caller may not be able to handle all the complexity but + # may want to see if the exporter will let them take a simpler + # view to its memory. + + # Some exporters may not be able to share memory in every possible + # way and may need to raise errors to signal to some consumers + # that something is just not possible. These errors should be a + # BufferError unless there is another error that is actually + # causing the problem. The exporter can use flags information to + # simplify how much of the Py_buffer structure is filled in with + # non-default values and/or raise an error if the object can’t + # support a simpler view of its memory. + + # 0 is returned on success and -1 on error. + + void PyBuffer_Release(Py_buffer *view) + # Release the buffer view. This should be called when the buffer + # is no longer being used as it may free memory from it. + + void* PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices) + # ?? + + Py_ssize_t PyBuffer_SizeFromFormat(char *) # actually const char + # Return the implied ~Py_buffer.itemsize from the struct-stype + # ~Py_buffer.format + + int PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort) + # ?? + + int PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort) + # ?? + + int PyObject_CopyToObject(object obj, void *buf, Py_ssize_t len, char fortran) except -1 + # Copy len bytes of data pointed to by the contiguous chunk of + # memory pointed to by buf into the buffer exported by obj. The + # buffer must of course be writable. Return 0 on success and + # return -1 and raise an error on failure. If the object does not + # have a writable buffer, then an error is raised. If fortran is + # 'F', then if the object is multi-dimensional, then the data will + # be copied into the array in Fortran-style (first dimension + # varies the fastest). If fortran is 'C', then the data will be + # copied into the array in C-style (last dimension varies the + # fastest). If fortran is 'A', then it does not matter and the + # copy will be made in whatever way is more efficient. + + int PyObject_CopyData(object dest, object src) except -1 + # Copy the data from the src buffer to the buffer of destination + + bint PyBuffer_IsContiguous(Py_buffer *view, char fort) + # Return 1 if the memory defined by the view is C-style (fortran + # is 'C') or Fortran-style (fortran is 'F') contiguous or either + # one (fortran is 'A'). Return 0 otherwise. + + void PyBuffer_FillContiguousStrides(int ndims, + Py_ssize_t *shape, + Py_ssize_t *strides, + Py_ssize_t itemsize, + char fort) + # Fill the strides array with byte-strides of a contiguous + # (Fortran-style if fort is 'F' or C-style otherwise) array of the + # given shape with the given number of bytes per element. + + int PyBuffer_FillInfo(Py_buffer *view, object exporter, void *buf, + Py_ssize_t len, int readonly, int flags) except -1 + # Fill in a buffer-info structure, view, correctly for an exporter + # that can only share a contiguous chunk of memory of “unsigned + # bytes” of the given length. Return 0 on success and -1 (with + # raising an error) on error. + + # DEPRECATED HERE: do not cimport from here, cimport from cpython.object instead + object PyObject_Format(object obj, object format_spec) + # Takes an arbitrary object and returns the result of calling + # obj.__format__(format_spec). |