diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/cython/Cython/Includes/cpython | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Includes/cpython')
15 files changed, 362 insertions, 362 deletions
diff --git a/contrib/tools/cython/Cython/Includes/cpython/array.pxd b/contrib/tools/cython/Cython/Includes/cpython/array.pxd index 19230a0a82..f19264624a 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/array.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/array.pxd @@ -131,14 +131,14 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero): """ fast creation of a new array, given a template array. type will be same as template. if zero is true, new array will be initialized with zeroes.""" - cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr) + cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr) if zero and op is not None: memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) return op cdef inline array copy(array self): """ make a copy of an array. """ - cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) + cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) return op diff --git a/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd b/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd index 3f1ada774a..e9b4cefc45 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/buffer.pxd @@ -3,9 +3,9 @@ cdef extern from "Python.h": cdef enum: - PyBUF_MAX_NDIM - - cdef enum: + PyBUF_MAX_NDIM + + cdef enum: PyBUF_SIMPLE, PyBUF_WRITABLE, PyBUF_WRITEABLE, # backwards compatibility diff --git a/contrib/tools/cython/Cython/Includes/cpython/cellobject.pxd b/contrib/tools/cython/Cython/Includes/cpython/cellobject.pxd index 5e3dd3d63c..fc3605ca4d 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/cellobject.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/cellobject.pxd @@ -1,35 +1,35 @@ -from .object cimport PyObject - -cdef extern from "Python.h": - - ############################################################################ - # Cell Objects - ############################################################################ - - bint PyCell_Check(object ob) - # Return true if ob is a cell object; ob must not be NULL. - - object PyCell_New(PyObject* ob) - # Return value: New reference. - # Create and return a new cell object containing the value ob. The - # parameter may be NULL. - - object PyCell_Get(object cell) - # Return value: New reference. - # Return the contents of the cell object cell. - - object PyCell_GET(object cell) - # Return value: Borrowed reference. - # Return the contents of the cell object cell, but without checking that - # cell is non-NULL and is a cell object. - - int PyCell_Set(object cell, PyObject* value) except? -1 - # Set the contents of the cell object cell to value. This releases the - # reference to any current content of the cell. value may be NULL. cell - # must be non-NULL; if it is not a cell object, -1 will be returned. On - # success, 0 will be returned. - - void PyCell_SET(object cell, PyObject* value) - # Sets the value of the cell object cell to value. No reference counts are - # adjusted, and no checks are made for safety; cell must be non-NULL and - # must be a cell object. +from .object cimport PyObject + +cdef extern from "Python.h": + + ############################################################################ + # Cell Objects + ############################################################################ + + bint PyCell_Check(object ob) + # Return true if ob is a cell object; ob must not be NULL. + + object PyCell_New(PyObject* ob) + # Return value: New reference. + # Create and return a new cell object containing the value ob. The + # parameter may be NULL. + + object PyCell_Get(object cell) + # Return value: New reference. + # Return the contents of the cell object cell. + + object PyCell_GET(object cell) + # Return value: Borrowed reference. + # Return the contents of the cell object cell, but without checking that + # cell is non-NULL and is a cell object. + + int PyCell_Set(object cell, PyObject* value) except? -1 + # Set the contents of the cell object cell to value. This releases the + # reference to any current content of the cell. value may be NULL. cell + # must be non-NULL; if it is not a cell object, -1 will be returned. On + # success, 0 will be returned. + + void PyCell_SET(object cell, PyObject* value) + # Sets the value of the cell object cell to value. No reference counts are + # adjusted, and no checks are made for safety; cell must be non-NULL and + # must be a cell object. diff --git a/contrib/tools/cython/Cython/Includes/cpython/codecs.pxd b/contrib/tools/cython/Cython/Includes/cpython/codecs.pxd index f2ca7d2444..dd57020bc1 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/codecs.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/codecs.pxd @@ -1,121 +1,121 @@ -cdef extern from "Python.h": - - ########################################################################### - # Codec registry and support functions - ########################################################################### - - int PyCodec_Register(object search_function) - # Register a new codec search function. - - # As side effect, this tries to load the encodings package, if not yet - # done, to make sure that it is always first in the list of search - # functions. - - int PyCodec_KnownEncoding(const char *encoding) - # Return 1 or 0 depending on whether there is a registered codec for the - # given encoding. This function always succeeds. - - object PyCodec_Encode(object o, const char *encoding, const char *errors) - # Return value: New reference. - # Generic codec based encoding API. - - # o is passed through the encoder function found for the given encoding - # using the error handling method defined by errors. errors may be NULL - # to use the default method defined for the codec. Raises a LookupError - # if no encoder can be found. - - object PyCodec_Decode(object o, const char *encoding, const char *errors) - # Return value: New reference. - # Generic codec based decoding API. - - # o is passed through the decoder function found for the given encoding - # using the error handling method defined by errors. errors may be NULL - # to use the default method defined for the codec. Raises a LookupError - # if no encoder can be found. - - - # Codec lookup API - - # In the following functions, the encoding string is looked up converted - # to all lower-case characters, which makes encodings looked up through - # this mechanism effectively case-insensitive. If no codec is found, a - # KeyError is set and NULL returned. - - object PyCodec_Encoder(const char *encoding) - # Return value: New reference. - # Get an encoder function for the given encoding. - - object PyCodec_Decoder(const char *encoding) - # Return value: New reference. - # Get a decoder function for the given encoding. - - object PyCodec_IncrementalEncoder(const char *encoding, const char *errors) - # Return value: New reference. - # Get an IncrementalEncoder object for the given encoding. - - object PyCodec_IncrementalDecoder(const char *encoding, const char *errors) - # Return value: New reference. - # Get an IncrementalDecoder object for the given encoding. - - object PyCodec_StreamReader(const char *encoding, object stream, const char *errors) - # Return value: New reference. - # Get a StreamReader factory function for the given encoding. - - object PyCodec_StreamWriter(const char *encoding, object stream, const char *errors) - # Return value: New reference. - # Get a StreamWriter factory function for the given encoding. - - - # Registry API for Unicode encoding error handlers - - int PyCodec_RegisterError(const char *name, object error) except? -1 - # Register the error handling callback function error under the given - # name. This callback function will be called by a codec when it - # encounters unencodable characters/undecodable bytes and name is - # specified as the error parameter in the call to the encode/decode - # function. - - # The callback gets a single argument, an instance of - # UnicodeEncodeError, UnicodeDecodeError or UnicodeTranslateError that - # holds information about the problematic sequence of characters or bytes - # and their offset in the original string (see Unicode Exception Objects - # for functions to extract this information). The callback must either - # raise the given exception, or return a two-item tuple containing the - # replacement for the problematic sequence, and an integer giving the - # offset in the original string at which encoding/decoding should be - # resumed. - - # Return 0 on success, -1 on error. - - object PyCodec_LookupError(const char *name) - # Return value: New reference. - # Lookup the error handling callback function registered under name. As a - # special case NULL can be passed, in which case the error handling - # callback for "strict" will be returned. - - object PyCodec_StrictErrors(object exc) - # Return value: Always NULL. - # Raise exc as an exception. - - object PyCodec_IgnoreErrors(object exc) - # Return value: New reference. - # Ignore the unicode error, skipping the faulty input. - - object PyCodec_ReplaceErrors(object exc) - # Return value: New reference. - # Replace the unicode encode error with "?" or "U+FFFD". - - object PyCodec_XMLCharRefReplaceErrors(object exc) - # Return value: New reference. - # Replace the unicode encode error with XML character references. - - object PyCodec_BackslashReplaceErrors(object exc) - # Return value: New reference. - # Replace the unicode encode error with backslash escapes ("\x", "\u" - # and "\U"). - - object PyCodec_NameReplaceErrors(object exc) - # Return value: New reference. - # Replace the unicode encode error with "\N{...}" escapes. - - # New in version 3.5. +cdef extern from "Python.h": + + ########################################################################### + # Codec registry and support functions + ########################################################################### + + int PyCodec_Register(object search_function) + # Register a new codec search function. + + # As side effect, this tries to load the encodings package, if not yet + # done, to make sure that it is always first in the list of search + # functions. + + int PyCodec_KnownEncoding(const char *encoding) + # Return 1 or 0 depending on whether there is a registered codec for the + # given encoding. This function always succeeds. + + object PyCodec_Encode(object o, const char *encoding, const char *errors) + # Return value: New reference. + # Generic codec based encoding API. + + # o is passed through the encoder function found for the given encoding + # using the error handling method defined by errors. errors may be NULL + # to use the default method defined for the codec. Raises a LookupError + # if no encoder can be found. + + object PyCodec_Decode(object o, const char *encoding, const char *errors) + # Return value: New reference. + # Generic codec based decoding API. + + # o is passed through the decoder function found for the given encoding + # using the error handling method defined by errors. errors may be NULL + # to use the default method defined for the codec. Raises a LookupError + # if no encoder can be found. + + + # Codec lookup API + + # In the following functions, the encoding string is looked up converted + # to all lower-case characters, which makes encodings looked up through + # this mechanism effectively case-insensitive. If no codec is found, a + # KeyError is set and NULL returned. + + object PyCodec_Encoder(const char *encoding) + # Return value: New reference. + # Get an encoder function for the given encoding. + + object PyCodec_Decoder(const char *encoding) + # Return value: New reference. + # Get a decoder function for the given encoding. + + object PyCodec_IncrementalEncoder(const char *encoding, const char *errors) + # Return value: New reference. + # Get an IncrementalEncoder object for the given encoding. + + object PyCodec_IncrementalDecoder(const char *encoding, const char *errors) + # Return value: New reference. + # Get an IncrementalDecoder object for the given encoding. + + object PyCodec_StreamReader(const char *encoding, object stream, const char *errors) + # Return value: New reference. + # Get a StreamReader factory function for the given encoding. + + object PyCodec_StreamWriter(const char *encoding, object stream, const char *errors) + # Return value: New reference. + # Get a StreamWriter factory function for the given encoding. + + + # Registry API for Unicode encoding error handlers + + int PyCodec_RegisterError(const char *name, object error) except? -1 + # Register the error handling callback function error under the given + # name. This callback function will be called by a codec when it + # encounters unencodable characters/undecodable bytes and name is + # specified as the error parameter in the call to the encode/decode + # function. + + # The callback gets a single argument, an instance of + # UnicodeEncodeError, UnicodeDecodeError or UnicodeTranslateError that + # holds information about the problematic sequence of characters or bytes + # and their offset in the original string (see Unicode Exception Objects + # for functions to extract this information). The callback must either + # raise the given exception, or return a two-item tuple containing the + # replacement for the problematic sequence, and an integer giving the + # offset in the original string at which encoding/decoding should be + # resumed. + + # Return 0 on success, -1 on error. + + object PyCodec_LookupError(const char *name) + # Return value: New reference. + # Lookup the error handling callback function registered under name. As a + # special case NULL can be passed, in which case the error handling + # callback for "strict" will be returned. + + object PyCodec_StrictErrors(object exc) + # Return value: Always NULL. + # Raise exc as an exception. + + object PyCodec_IgnoreErrors(object exc) + # Return value: New reference. + # Ignore the unicode error, skipping the faulty input. + + object PyCodec_ReplaceErrors(object exc) + # Return value: New reference. + # Replace the unicode encode error with "?" or "U+FFFD". + + object PyCodec_XMLCharRefReplaceErrors(object exc) + # Return value: New reference. + # Replace the unicode encode error with XML character references. + + object PyCodec_BackslashReplaceErrors(object exc) + # Return value: New reference. + # Replace the unicode encode error with backslash escapes ("\x", "\u" + # and "\U"). + + object PyCodec_NameReplaceErrors(object exc) + # Return value: New reference. + # Replace the unicode encode error with "\N{...}" escapes. + + # New in version 3.5. diff --git a/contrib/tools/cython/Cython/Includes/cpython/conversion.pxd b/contrib/tools/cython/Cython/Includes/cpython/conversion.pxd index 18e2c3d1a6..f779f52673 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/conversion.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/conversion.pxd @@ -1,36 +1,36 @@ -# From https://docs.python.org/3/c-api/conversion.html - -from .object cimport PyObject - -cdef extern from "Python.h": - ctypedef struct va_list - - int PyOS_snprintf(char *str, size_t size, const char *format, ...) - # Output not more than size bytes to str according to the format - # string format and the extra arguments. See the Unix man page snprintf(2). - - int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) - # Output not more than size bytes to str according to the format - # string format and the variable argument list va. Unix man page vsnprintf(2). - - double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception) except? -1.0 - # Convert a string s to a double, raising a Python exception on failure. The set of - # accepted strings corresponds to the set of strings accepted by Python’s float() - # constructor, except that s must not have leading or trailing whitespace. - # The conversion is independent of the current locale. - - enum: - Py_DTSF_SIGN - Py_DTSF_ADD_DOT_0 - Py_DTSF_ALT - - char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype) except NULL - # Convert a double val to a string using supplied format_code, precision, and flags. - - int PyOS_stricmp(const char *s1, const char *s2) - # Case insensitive comparison of strings. The function works almost identically - # to strcmp() except that it ignores the case. - - int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t size) - # Case insensitive comparison of strings. The function works almost identically - # to strncmp() except that it ignores the case. +# From https://docs.python.org/3/c-api/conversion.html + +from .object cimport PyObject + +cdef extern from "Python.h": + ctypedef struct va_list + + int PyOS_snprintf(char *str, size_t size, const char *format, ...) + # Output not more than size bytes to str according to the format + # string format and the extra arguments. See the Unix man page snprintf(2). + + int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) + # Output not more than size bytes to str according to the format + # string format and the variable argument list va. Unix man page vsnprintf(2). + + double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception) except? -1.0 + # Convert a string s to a double, raising a Python exception on failure. The set of + # accepted strings corresponds to the set of strings accepted by Python’s float() + # constructor, except that s must not have leading or trailing whitespace. + # The conversion is independent of the current locale. + + enum: + Py_DTSF_SIGN + Py_DTSF_ADD_DOT_0 + Py_DTSF_ALT + + char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype) except NULL + # Convert a double val to a string using supplied format_code, precision, and flags. + + int PyOS_stricmp(const char *s1, const char *s2) + # Case insensitive comparison of strings. The function works almost identically + # to strcmp() except that it ignores the case. + + int PyOS_strnicmp(const char *s1, const char *s2, Py_ssize_t size) + # Case insensitive comparison of strings. The function works almost identically + # to strncmp() except that it ignores the case. diff --git a/contrib/tools/cython/Cython/Includes/cpython/datetime.pxd b/contrib/tools/cython/Cython/Includes/cpython/datetime.pxd index cd0f90719b..d3c80b07df 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/datetime.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/datetime.pxd @@ -90,9 +90,9 @@ cdef extern from "datetime.h": int PyDateTime_TIME_GET_MICROSECOND(object o) # Getters for timedelta (C macros). - int PyDateTime_DELTA_GET_DAYS(object o) - int PyDateTime_DELTA_GET_SECONDS(object o) - int PyDateTime_DELTA_GET_MICROSECONDS(object o) + int PyDateTime_DELTA_GET_DAYS(object o) + int PyDateTime_DELTA_GET_SECONDS(object o) + int PyDateTime_DELTA_GET_MICROSECONDS(object o) # PyDateTime CAPI object. PyDateTime_CAPI *PyDateTimeAPI diff --git a/contrib/tools/cython/Cython/Includes/cpython/genobject.pxd b/contrib/tools/cython/Cython/Includes/cpython/genobject.pxd index 337b3cc0ad..0dd63fbbf0 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/genobject.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/genobject.pxd @@ -1,25 +1,25 @@ -from .pystate cimport PyFrameObject - -cdef extern from "Python.h": - - ########################################################################### - # Generator Objects - ########################################################################### - - bint PyGen_Check(object ob) - # Return true if ob is a generator object; ob must not be NULL. - - bint PyGen_CheckExact(object ob) - # Return true if ob's type is PyGen_Type; ob must not be NULL. - - object PyGen_New(PyFrameObject *frame) - # Return value: New reference. - # Create and return a new generator object based on the frame object. A - # reference to frame is stolen by this function. The argument must not be - # NULL. - - object PyGen_NewWithQualName(PyFrameObject *frame, object name, object qualname) - # Return value: New reference. - # Create and return a new generator object based on the frame object, with - # __name__ and __qualname__ set to name and qualname. A reference to frame - # is stolen by this function. The frame argument must not be NULL. +from .pystate cimport PyFrameObject + +cdef extern from "Python.h": + + ########################################################################### + # Generator Objects + ########################################################################### + + bint PyGen_Check(object ob) + # Return true if ob is a generator object; ob must not be NULL. + + bint PyGen_CheckExact(object ob) + # Return true if ob's type is PyGen_Type; ob must not be NULL. + + object PyGen_New(PyFrameObject *frame) + # Return value: New reference. + # Create and return a new generator object based on the frame object. A + # reference to frame is stolen by this function. The argument must not be + # NULL. + + object PyGen_NewWithQualName(PyFrameObject *frame, object name, object qualname) + # Return value: New reference. + # Create and return a new generator object based on the frame object, with + # __name__ and __qualname__ set to name and qualname. A reference to frame + # is stolen by this function. The frame argument must not be NULL. diff --git a/contrib/tools/cython/Cython/Includes/cpython/iterobject.pxd b/contrib/tools/cython/Cython/Includes/cpython/iterobject.pxd index a70aeccb09..8aa0387ca9 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/iterobject.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/iterobject.pxd @@ -1,24 +1,24 @@ -cdef extern from "Python.h": - - ########################################################################### - # Iterator Objects - ########################################################################### - - bint PySeqIter_Check(object op) - # Return true if the type of op is PySeqIter_Type. - - object PySeqIter_New(object seq) - # Return value: New reference. - # Return an iterator that works with a general sequence object, seq. The - # iteration ends when the sequence raises IndexError for the subscripting - # operation. - - bint PyCallIter_Check(object op) - # Return true if the type of op is PyCallIter_Type. - - object PyCallIter_New(object callable, object sentinel) - # Return value: New reference. - # Return a new iterator. The first parameter, callable, can be any Python - # callable object that can be called with no parameters; each call to it - # should return the next item in the iteration. When callable returns a - # value equal to sentinel, the iteration will be terminated. +cdef extern from "Python.h": + + ########################################################################### + # Iterator Objects + ########################################################################### + + bint PySeqIter_Check(object op) + # Return true if the type of op is PySeqIter_Type. + + object PySeqIter_New(object seq) + # Return value: New reference. + # Return an iterator that works with a general sequence object, seq. The + # iteration ends when the sequence raises IndexError for the subscripting + # operation. + + bint PyCallIter_Check(object op) + # Return true if the type of op is PyCallIter_Type. + + object PyCallIter_New(object callable, object sentinel) + # Return value: New reference. + # Return a new iterator. The first parameter, callable, can be any Python + # callable object that can be called with no parameters; each call to it + # should return the next item in the iteration. When callable returns a + # value equal to sentinel, the iteration will be terminated. diff --git a/contrib/tools/cython/Cython/Includes/cpython/longintrepr.pxd b/contrib/tools/cython/Cython/Includes/cpython/longintrepr.pxd index c38c1bff88..efae540d05 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/longintrepr.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/longintrepr.pxd @@ -1,11 +1,11 @@ # Internals of the "long" type (Python 2) or "int" type (Python 3). -cdef extern from "Python.h": - """ - #if PY_MAJOR_VERSION < 3 - #include "longintrepr.h" - #endif - """ +cdef extern from "Python.h": + """ + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif + """ ctypedef unsigned int digit ctypedef int sdigit # Python >= 2.7 only diff --git a/contrib/tools/cython/Cython/Includes/cpython/memoryview.pxd b/contrib/tools/cython/Cython/Includes/cpython/memoryview.pxd index 83a84e6f91..8274f42af9 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/memoryview.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/memoryview.pxd @@ -1,50 +1,50 @@ -cdef extern from "Python.h": - - ########################################################################### - # MemoryView Objects - ########################################################################### - # A memoryview object exposes the C level buffer interface as a Python - # object which can then be passed around like any other object - - object PyMemoryView_FromObject(object obj) - # Return value: New reference. - # Create a memoryview object from an object that provides the buffer - # interface. If obj supports writable buffer exports, the memoryview object - # will be read/write, otherwise it may be either read-only or read/write at - # the discretion of the exporter. - - object PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags) - # Return value: New reference. - # Create a memoryview object using mem as the underlying buffer. flags can - # be one of PyBUF_READ or PyBUF_WRITE. - # New in version 3.3. - - object PyMemoryView_FromBuffer(Py_buffer *view) - # Return value: New reference. - # Create a memoryview object wrapping the given buffer structure view. For - # simple byte buffers, PyMemoryView_FromMemory() is the preferred function. - - object PyMemoryView_GetContiguous(object obj, - int buffertype, - char order) - # Return value: New reference. - # Create a memoryview object to a contiguous chunk of memory (in either ‘C’ - # or ‘F’ortran order) from an object that defines the buffer interface. If - # memory is contiguous, the memoryview object points to the original - # memory. Otherwise, a copy is made and the memoryview points to a new - # bytes object. - - bint PyMemoryView_Check(object obj) - # Return true if the object obj is a memoryview object. It is not currently - # allowed to create subclasses of memoryview. - - Py_buffer *PyMemoryView_GET_BUFFER(object mview) - # Return a pointer to the memoryview’s private copy of the exporter’s - # buffer. mview must be a memoryview instance; this macro doesn’t check its - # type, you must do it yourself or you will risk crashes. - - Py_buffer *PyMemoryView_GET_BASE(object mview) - # Return either a pointer to the exporting object that the memoryview is - # based on or NULL if the memoryview has been created by one of the - # functions PyMemoryView_FromMemory() or PyMemoryView_FromBuffer(). mview - # must be a memoryview instance. +cdef extern from "Python.h": + + ########################################################################### + # MemoryView Objects + ########################################################################### + # A memoryview object exposes the C level buffer interface as a Python + # object which can then be passed around like any other object + + object PyMemoryView_FromObject(object obj) + # Return value: New reference. + # Create a memoryview object from an object that provides the buffer + # interface. If obj supports writable buffer exports, the memoryview object + # will be read/write, otherwise it may be either read-only or read/write at + # the discretion of the exporter. + + object PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags) + # Return value: New reference. + # Create a memoryview object using mem as the underlying buffer. flags can + # be one of PyBUF_READ or PyBUF_WRITE. + # New in version 3.3. + + object PyMemoryView_FromBuffer(Py_buffer *view) + # Return value: New reference. + # Create a memoryview object wrapping the given buffer structure view. For + # simple byte buffers, PyMemoryView_FromMemory() is the preferred function. + + object PyMemoryView_GetContiguous(object obj, + int buffertype, + char order) + # Return value: New reference. + # Create a memoryview object to a contiguous chunk of memory (in either ‘C’ + # or ‘F’ortran order) from an object that defines the buffer interface. If + # memory is contiguous, the memoryview object points to the original + # memory. Otherwise, a copy is made and the memoryview points to a new + # bytes object. + + bint PyMemoryView_Check(object obj) + # Return true if the object obj is a memoryview object. It is not currently + # allowed to create subclasses of memoryview. + + Py_buffer *PyMemoryView_GET_BUFFER(object mview) + # Return a pointer to the memoryview’s private copy of the exporter’s + # buffer. mview must be a memoryview instance; this macro doesn’t check its + # type, you must do it yourself or you will risk crashes. + + Py_buffer *PyMemoryView_GET_BASE(object mview) + # Return either a pointer to the exporting object that the memoryview is + # based on or NULL if the memoryview has been created by one of the + # functions PyMemoryView_FromMemory() or PyMemoryView_FromBuffer(). mview + # must be a memoryview instance. diff --git a/contrib/tools/cython/Cython/Includes/cpython/number.pxd b/contrib/tools/cython/Cython/Includes/cpython/number.pxd index ded35c292a..df6c637c33 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/number.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/number.pxd @@ -27,13 +27,13 @@ cdef extern from "Python.h": # failure. This is the equivalent of the Python expression "o1 * # o2". - object PyNumber_MatrixMultiply(object o1, object o2) - # Return value: New reference. - # Returns the result of matrix multiplication on o1 and o2, or - # NULL on failure. This is the equivalent of the Python - # expression "o1 @ o2". - # New in version 3.5. - + object PyNumber_MatrixMultiply(object o1, object o2) + # Return value: New reference. + # Returns the result of matrix multiplication on o1 and o2, or + # NULL on failure. This is the equivalent of the Python + # expression "o1 @ o2". + # New in version 3.5. + object PyNumber_Divide(object o1, object o2) # Return value: New reference. # Returns the result of dividing o1 by o2, or NULL on @@ -140,13 +140,13 @@ cdef extern from "Python.h": # failure. The operation is done in-place when o1 supports # it. This is the equivalent of the Python statement "o1 *= o2". - object PyNumber_InPlaceMatrixMultiply(object o1, object o2) - # Return value: New reference. - # Returns the result of matrix multiplication on o1 and o2, or - # NULL on failure. The operation is done in-place when o1 supports - # it. This is the equivalent of the Python statement "o1 @= o2". - # New in version 3.5. - + object PyNumber_InPlaceMatrixMultiply(object o1, object o2) + # Return value: New reference. + # Returns the result of matrix multiplication on o1 and o2, or + # NULL on failure. The operation is done in-place when o1 supports + # it. This is the equivalent of the Python statement "o1 @= o2". + # New in version 3.5. + object PyNumber_InPlaceDivide(object o1, object o2) # Return value: New reference. # Returns the result of dividing o1 by o2, or NULL on failure. The diff --git a/contrib/tools/cython/Cython/Includes/cpython/pycapsule.pxd b/contrib/tools/cython/Cython/Includes/cpython/pycapsule.pxd index c3d12c7490..31aa5f5b7f 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/pycapsule.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/pycapsule.pxd @@ -24,7 +24,7 @@ cdef extern from "Python.h": # Return true if its argument is a PyCapsule. - object PyCapsule_New(void *pointer, const char *name, + object PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor) # Return value: New reference. # @@ -47,7 +47,7 @@ cdef extern from "Python.h": # PyCapsule_Import(). - void* PyCapsule_GetPointer(object capsule, const char *name) except? NULL + void* PyCapsule_GetPointer(object capsule, const char *name) except? NULL # Retrieve the pointer stored in the capsule. On failure, set an # exception and return NULL. # @@ -66,7 +66,7 @@ cdef extern from "Python.h": # or PyErr_Occurred() to disambiguate. - const char* PyCapsule_GetName(object capsule) except? NULL + const char* PyCapsule_GetName(object capsule) except? NULL # Return the current name stored in the capsule. On failure, set # an exception and return NULL. # @@ -84,7 +84,7 @@ cdef extern from "Python.h": # PyErr_Occurred() to disambiguate. - bint PyCapsule_IsValid(object capsule, const char *name) + bint PyCapsule_IsValid(object capsule, const char *name) # Determines whether or not capsule is a valid capsule. A valid # capsule is non-NULL, passes PyCapsule_CheckExact(), has a # non-NULL pointer stored in it, and its internal name matches the @@ -114,7 +114,7 @@ cdef extern from "Python.h": # failure. - int PyCapsule_SetName(object capsule, const char *name) except -1 + int PyCapsule_SetName(object capsule, const char *name) except -1 # Set the name inside capsule to name. If non-NULL, the name must # outlive the capsule. If the previous name stored in the capsule # was not NULL, no attempt is made to free it. @@ -128,7 +128,7 @@ cdef extern from "Python.h": # success. Return nonzero and set an exception on failure. - void* PyCapsule_Import(const char *name, int no_block) except? NULL + void* PyCapsule_Import(const char *name, int no_block) except? NULL # Import a pointer to a C object from a capsule attribute in a # module. The name parameter should specify the full name to the # attribute, as in module.attribute. The name stored in the diff --git a/contrib/tools/cython/Cython/Includes/cpython/pylifecycle.pxd b/contrib/tools/cython/Cython/Includes/cpython/pylifecycle.pxd index 2c71e37163..919c18c487 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/pylifecycle.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/pylifecycle.pxd @@ -27,9 +27,9 @@ cdef extern from "Python.h": void Py_EndInterpreter(PyThreadState *) - # _Py_PyAtExit is for the atexit module, Py_AtExit is for low-level + # _Py_PyAtExit is for the atexit module, Py_AtExit is for low-level # exit functions. - void _Py_PyAtExit(void (*func)(object), object) + void _Py_PyAtExit(void (*func)(object), object) int Py_AtExit(void (*func)()) void Py_Exit(int) diff --git a/contrib/tools/cython/Cython/Includes/cpython/slice.pxd b/contrib/tools/cython/Cython/Includes/cpython/slice.pxd index 202dea716c..ea81cbc3fe 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/slice.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/slice.pxd @@ -45,26 +45,26 @@ cdef extern from "Python.h": # # Changed in version 3.2: The parameter type for the slice parameter was # PySliceObject* before. - - int PySlice_Unpack(object slice, Py_ssize_t *start, Py_ssize_t *stop, - Py_ssize_t *step) except -1 - # Extract the start, stop and step data members from a slice object as C - # integers. Silently reduce values larger than PY_SSIZE_T_MAX to - # PY_SSIZE_T_MAX, silently boost the start and stop values less than - # PY_SSIZE_T_MIN to PY_SSIZE_T_MIN, and silently boost the step values - # less than -PY_SSIZE_T_MAX to -PY_SSIZE_T_MAX. - - # Return -1 on error, 0 on success. - - # New in version 3.6.1. - - Py_ssize_t PySlice_AdjustIndices(Py_ssize_t length, Py_ssize_t *start, - Py_ssize_t *stop, Py_ssize_t step) - # Adjust start/end slice indices assuming a sequence of the specified - # length. Out of bounds indices are clipped in a manner consistent with - # the handling of normal slices. - - # Return the length of the slice. Always successful. Doesn’t call Python - # code. - - # New in version 3.6.1. + + int PySlice_Unpack(object slice, Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t *step) except -1 + # Extract the start, stop and step data members from a slice object as C + # integers. Silently reduce values larger than PY_SSIZE_T_MAX to + # PY_SSIZE_T_MAX, silently boost the start and stop values less than + # PY_SSIZE_T_MIN to PY_SSIZE_T_MIN, and silently boost the step values + # less than -PY_SSIZE_T_MAX to -PY_SSIZE_T_MAX. + + # Return -1 on error, 0 on success. + + # New in version 3.6.1. + + Py_ssize_t PySlice_AdjustIndices(Py_ssize_t length, Py_ssize_t *start, + Py_ssize_t *stop, Py_ssize_t step) + # Adjust start/end slice indices assuming a sequence of the specified + # length. Out of bounds indices are clipped in a manner consistent with + # the handling of normal slices. + + # Return the length of the slice. Always successful. Doesn’t call Python + # code. + + # New in version 3.6.1. diff --git a/contrib/tools/cython/Cython/Includes/cpython/unicode.pxd b/contrib/tools/cython/Cython/Includes/cpython/unicode.pxd index ad01ed64df..6e412e3324 100644 --- a/contrib/tools/cython/Cython/Includes/cpython/unicode.pxd +++ b/contrib/tools/cython/Cython/Includes/cpython/unicode.pxd @@ -10,19 +10,19 @@ cdef extern from *: # Return the size of the object. o has to be a PyUnicodeObject # (not checked). - # - # Deprecated since version 3.3, will be removed in version 3.10: - # Part of the old-style Unicode API, please migrate to using - # PyUnicode_GET_LENGTH(). + # + # Deprecated since version 3.3, will be removed in version 3.10: + # Part of the old-style Unicode API, please migrate to using + # PyUnicode_GET_LENGTH(). Py_ssize_t PyUnicode_GET_SIZE(object o) - # Return the length of the Unicode string, in code points. o has - # to be a Unicode object in the “canonical” representation (not - # checked). - # - # New in version 3.3. - Py_ssize_t PyUnicode_GET_LENGTH(object o) - + # Return the length of the Unicode string, in code points. o has + # to be a Unicode object in the “canonical” representation (not + # checked). + # + # New in version 3.3. + Py_ssize_t PyUnicode_GET_LENGTH(object o) + # Return the size of the object's internal buffer in bytes. o has # to be a PyUnicodeObject (not checked). Py_ssize_t PyUnicode_GET_DATA_SIZE(object o) @@ -226,7 +226,7 @@ cdef extern from *: # equal, and greater than, respectively. It is best to pass only ASCII-encoded # strings, but the function interprets the input string as ISO-8859-1 if it # contains non-ASCII characters. - int PyUnicode_CompareWithASCIIString(object uni, const char *string) + int PyUnicode_CompareWithASCIIString(object uni, const char *string) # Rich compare two unicode strings and return one of the following: # |