diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-06-13 11:05:01 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-06-13 11:05:01 +0300 |
commit | bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch) | |
tree | 1d1df72c0541a59a81439842f46d95396d3e7189 /contrib/tools/cython/Cython/Includes/cpython/oldbuffer.pxd | |
parent | 8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff) | |
download | ydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz |
add ymake export to ydb
Diffstat (limited to 'contrib/tools/cython/Cython/Includes/cpython/oldbuffer.pxd')
-rw-r--r-- | contrib/tools/cython/Cython/Includes/cpython/oldbuffer.pxd | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/contrib/tools/cython/Cython/Includes/cpython/oldbuffer.pxd b/contrib/tools/cython/Cython/Includes/cpython/oldbuffer.pxd new file mode 100644 index 0000000000..0222428ed4 --- /dev/null +++ b/contrib/tools/cython/Cython/Includes/cpython/oldbuffer.pxd @@ -0,0 +1,63 @@ +# Legacy Python 2 buffer interface. +# +# These functions are no longer available in Python 3, use the new +# buffer interface instead. + +cdef extern from "Python.h": + cdef enum _: + Py_END_OF_BUFFER + # This constant may be passed as the size parameter to + # PyBuffer_FromObject() or PyBuffer_FromReadWriteObject(). It + # indicates that the new PyBufferObject should refer to base object + # from the specified offset to the end of its exported + # buffer. Using this enables the caller to avoid querying the base + # object for its length. + + bint PyBuffer_Check(object p) + # Return true if the argument has type PyBuffer_Type. + + object PyBuffer_FromObject(object base, Py_ssize_t offset, Py_ssize_t size) + # Return value: New reference. + # + # Return a new read-only buffer object. This raises TypeError if + # base doesn't support the read-only buffer protocol or doesn't + # provide exactly one buffer segment, or it raises ValueError if + # offset is less than zero. The buffer will hold a reference to the + # base object, and the buffer's contents will refer to the base + # object's buffer interface, starting as position offset and + # extending for size bytes. If size is Py_END_OF_BUFFER, then the + # new buffer's contents extend to the length of the base object's + # exported buffer data. + + object PyBuffer_FromReadWriteObject(object base, Py_ssize_t offset, Py_ssize_t size) + # Return value: New reference. + # + # Return a new writable buffer object. Parameters and exceptions + # are similar to those for PyBuffer_FromObject(). If the base + # object does not export the writeable buffer protocol, then + # TypeError is raised. + + object PyBuffer_FromMemory(void *ptr, Py_ssize_t size) + # Return value: New reference. + # + # Return a new read-only buffer object that reads from a specified + # location in memory, with a specified size. The caller is + # responsible for ensuring that the memory buffer, passed in as + # ptr, is not deallocated while the returned buffer object + # exists. Raises ValueError if size is less than zero. Note that + # Py_END_OF_BUFFER may not be passed for the size parameter; + # ValueError will be raised in that case. + + object PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size) + # Return value: New reference. + # + # Similar to PyBuffer_FromMemory(), but the returned buffer is + # writable. + + object PyBuffer_New(Py_ssize_t size) + # Return value: New reference. + # + # Return a new writable buffer object that maintains its own memory + # buffer of size bytes. ValueError is returned if size is not zero + # or positive. Note that the memory buffer (as returned by + # PyObject_AsWriteBuffer()) is not specifically aligned. |