aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-05-31 21:49:01 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-05-31 21:49:01 +0300
commitceb13dcc40dd5e11c8e3189b3c15b3bd5897d4ac (patch)
treeeda501e07fcaba4f64bc3d29725472162f2e4227 /contrib/tools
parent5b69557e440e6ac18399a29076fef25602859f17 (diff)
downloadydb-ceb13dcc40dd5e11c8e3189b3c15b3bd5897d4ac.tar.gz
intermediate changes
ref:85306a27df0004d13faf777131d0b092370e6b90
Diffstat (limited to 'contrib/tools')
-rw-r--r--contrib/tools/cython/.dist-info/METADATA5
-rw-r--r--contrib/tools/cython/.dist-info/entry_points.txt1
-rw-r--r--contrib/tools/cython/CHANGES.rst59
-rw-r--r--contrib/tools/cython/Cython/Compiler/Builtin.py15
-rw-r--r--contrib/tools/cython/Cython/Compiler/Code.py4
-rw-r--r--contrib/tools/cython/Cython/Compiler/Nodes.py6
-rw-r--r--contrib/tools/cython/Cython/Compiler/ParseTreeTransforms.py26
-rw-r--r--contrib/tools/cython/Cython/Compiler/TypeSlots.py14
-rw-r--r--contrib/tools/cython/Cython/Shadow.py4
-rw-r--r--contrib/tools/cython/Cython/Utility/Coroutine.c6
-rw-r--r--contrib/tools/cython/Cython/Utility/CythonFunction.c7
-rw-r--r--contrib/tools/cython/Cython/Utility/Exceptions.c18
-rw-r--r--contrib/tools/cython/Cython/Utility/ExtensionTypes.c25
-rw-r--r--contrib/tools/cython/Cython/Utility/ModuleSetupCode.c46
-rw-r--r--contrib/tools/cython/Cython/Utility/ObjectHandling.c7
-rw-r--r--contrib/tools/cython/Cython/Utility/Profile.c6
-rw-r--r--contrib/tools/cython/Cython/Utility/StringTools.c2
-rwxr-xr-xcontrib/tools/cython/cython.py2
18 files changed, 217 insertions, 36 deletions
diff --git a/contrib/tools/cython/.dist-info/METADATA b/contrib/tools/cython/.dist-info/METADATA
index 1020a3fa70..9e2dc74319 100644
--- a/contrib/tools/cython/.dist-info/METADATA
+++ b/contrib/tools/cython/.dist-info/METADATA
@@ -1,12 +1,11 @@
Metadata-Version: 2.1
Name: Cython
-Version: 0.29.28
+Version: 0.29.30
Summary: The Cython compiler for writing C extensions for the Python language.
Home-page: http://cython.org/
Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al.
Author-email: cython-devel@python.org
License: Apache
-Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
@@ -56,5 +55,3 @@ to install an uncompiled (slower) version of Cython with::
pip install Cython --install-option="--no-cython-compile"
.. _Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
-
-
diff --git a/contrib/tools/cython/.dist-info/entry_points.txt b/contrib/tools/cython/.dist-info/entry_points.txt
index 696613646a..f8b3914454 100644
--- a/contrib/tools/cython/.dist-info/entry_points.txt
+++ b/contrib/tools/cython/.dist-info/entry_points.txt
@@ -2,4 +2,3 @@
cygdb = Cython.Debugger.Cygdb:main
cython = Cython.Compiler.Main:setuptools_main
cythonize = Cython.Build.Cythonize:main
-
diff --git a/contrib/tools/cython/CHANGES.rst b/contrib/tools/cython/CHANGES.rst
index 720320e79b..7087a93913 100644
--- a/contrib/tools/cython/CHANGES.rst
+++ b/contrib/tools/cython/CHANGES.rst
@@ -2,6 +2,65 @@
Cython Changelog
================
+0.29.30 (2022-05-16)
+====================
+
+Bugs fixed
+----------
+
+* The GIL handling changes in 0.29.29 introduced a regression where
+ objects could be deallocated without holding the GIL.
+ (Github issue #4796)
+
+
+0.29.29 (2022-05-16)
+====================
+
+Features added
+--------------
+
+* Avoid acquiring the GIL at the end of nogil functions.
+ This change was backported in order to avoid generating wrong C code
+ that would trigger C compiler warnings with tracing support enabled.
+ Backport by Oleksandr Pavlyk. (Github issue #4637)
+
+Bugs fixed
+----------
+
+* Function definitions in ``finally:`` clauses were not correctly generated.
+ Patch by David Woods. (Github issue #4651)
+
+* A case where C-API functions could be called with a live exception set was fixed.
+ Patch by Jakub Kulík. (Github issue #4722)
+
+* Pickles can now be exchanged again with those generated from Cython 3.0 modules.
+ (Github issue #4680)
+
+* Cython now correctly generates Python methods for both the provided regular and
+ reversed special numeric methods of extension types.
+ Patch by David Woods. (Github issue #4750)
+
+* Calling unbound extension type methods without arguments could raise an
+ ``IndexError`` instead of a ``TypeError``.
+ Patch by David Woods. (Github issue #4779)
+
+* Calling unbound ``.__contains__()`` super class methods on some builtin base
+ types could trigger an infinite recursion.
+ Patch by David Woods. (Github issue #4785)
+
+* The C union type in pure Python mode mishandled some field names.
+ Patch by Jordan Brière. (Github issue #4727)
+
+* Allow users to overwrite the C macro ``_USE_MATH_DEFINES``.
+ Patch by Yuriy Chernyshov. (Github issue #4690)
+
+* Improved compatibility with CPython 3.10/11.
+ Patches by Thomas Caswell, David Woods. (Github issues #4609, #4667, #4721, #4730, #4777)
+
+* Docstrings of descriptors are now provided in PyPy 7.3.9.
+ Patch by Matti Picus. (Github issue #4701)
+
+
0.29.28 (2022-02-17)
====================
diff --git a/contrib/tools/cython/Cython/Compiler/Builtin.py b/contrib/tools/cython/Cython/Compiler/Builtin.py
index 5fa717507d..e0d203ae02 100644
--- a/contrib/tools/cython/Cython/Compiler/Builtin.py
+++ b/contrib/tools/cython/Cython/Compiler/Builtin.py
@@ -271,12 +271,10 @@ builtin_types_table = [
]),
("bytearray", "PyByteArray_Type", [
]),
- ("bytes", "PyBytes_Type", [BuiltinMethod("__contains__", "TO", "b", "PySequence_Contains"),
- BuiltinMethod("join", "TO", "O", "__Pyx_PyBytes_Join",
+ ("bytes", "PyBytes_Type", [BuiltinMethod("join", "TO", "O", "__Pyx_PyBytes_Join",
utility_code=UtilityCode.load("StringJoin", "StringTools.c")),
]),
- ("str", "PyString_Type", [BuiltinMethod("__contains__", "TO", "b", "PySequence_Contains"),
- BuiltinMethod("join", "TO", "O", "__Pyx_PyString_Join",
+ ("str", "PyString_Type", [BuiltinMethod("join", "TO", "O", "__Pyx_PyString_Join",
builtin_return_type='basestring',
utility_code=UtilityCode.load("StringJoin", "StringTools.c")),
]),
@@ -284,11 +282,9 @@ builtin_types_table = [
BuiltinMethod("join", "TO", "T", "PyUnicode_Join"),
]),
- ("tuple", "PyTuple_Type", [BuiltinMethod("__contains__", "TO", "b", "PySequence_Contains"),
- ]),
+ ("tuple", "PyTuple_Type", []),
- ("list", "PyList_Type", [BuiltinMethod("__contains__", "TO", "b", "PySequence_Contains"),
- BuiltinMethod("insert", "TzO", "r", "PyList_Insert"),
+ ("list", "PyList_Type", [BuiltinMethod("insert", "TzO", "r", "PyList_Insert"),
BuiltinMethod("reverse", "T", "r", "PyList_Reverse"),
BuiltinMethod("append", "TO", "r", "__Pyx_PyList_Append",
utility_code=UtilityCode.load("ListAppend", "Optimize.c")),
@@ -326,8 +322,7 @@ builtin_types_table = [
]),
# ("file", "PyFile_Type", []), # not in Py3
- ("set", "PySet_Type", [BuiltinMethod("__contains__", "TO", "b", "PySequence_Contains"),
- BuiltinMethod("clear", "T", "r", "PySet_Clear"),
+ ("set", "PySet_Type", [BuiltinMethod("clear", "T", "r", "PySet_Clear"),
# discard() and remove() have a special treatment for unhashable values
BuiltinMethod("discard", "TO", "r", "__Pyx_PySet_Discard",
utility_code=UtilityCode.load("py_set_discard", "Optimize.c")),
diff --git a/contrib/tools/cython/Cython/Compiler/Code.py b/contrib/tools/cython/Cython/Compiler/Code.py
index f43c4b2b8e..45c5a325cf 100644
--- a/contrib/tools/cython/Cython/Compiler/Code.py
+++ b/contrib/tools/cython/Cython/Compiler/Code.py
@@ -2233,8 +2233,8 @@ class CCodeWriter(object):
method_flags = entry.signature.method_flags()
if not method_flags:
return
- if entry.is_special:
- from . import TypeSlots
+ from . import TypeSlots
+ if entry.is_special or TypeSlots.is_reverse_number_slot(entry.name):
method_flags += [TypeSlots.method_coexist]
func_ptr = wrapper_code_writer.put_pymethoddef_wrapper(entry) if wrapper_code_writer else entry.func_cname
# Add required casts, but try not to shadow real warnings.
diff --git a/contrib/tools/cython/Cython/Compiler/Nodes.py b/contrib/tools/cython/Cython/Compiler/Nodes.py
index 6436c5002d..c5be70040c 100644
--- a/contrib/tools/cython/Cython/Compiler/Nodes.py
+++ b/contrib/tools/cython/Cython/Compiler/Nodes.py
@@ -3461,7 +3461,7 @@ class DefNodeWrapper(FuncDefNode):
docstr.as_c_string_literal()))
if entry.is_special:
- code.putln('#if CYTHON_COMPILING_IN_CPYTHON')
+ code.putln('#if CYTHON_UPDATE_DESCRIPTOR_DOC')
code.putln(
"struct wrapperbase %s;" % entry.wrapperbase_cname)
code.putln('#endif')
@@ -4957,7 +4957,7 @@ class CClassDefNode(ClassDefNode):
preprocessor_guard = slot.preprocessor_guard_code() if slot else None
if preprocessor_guard:
code.putln(preprocessor_guard)
- code.putln('#if CYTHON_COMPILING_IN_CPYTHON')
+ code.putln('#if CYTHON_UPDATE_DESCRIPTOR_DOC')
code.putln("{")
code.putln(
'PyObject *wrapper = PyObject_GetAttrString((PyObject *)&%s, "%s"); %s' % (
@@ -7703,6 +7703,8 @@ class TryFinallyStatNode(StatNode):
def generate_function_definitions(self, env, code):
self.body.generate_function_definitions(env, code)
self.finally_clause.generate_function_definitions(env, code)
+ if self.finally_except_clause:
+ self.finally_except_clause.generate_function_definitions(env, code)
def put_error_catcher(self, code, temps_to_clean_up, exc_vars,
exc_lineno_cnames=None, exc_filename_cname=None):
diff --git a/contrib/tools/cython/Cython/Compiler/ParseTreeTransforms.py b/contrib/tools/cython/Cython/Compiler/ParseTreeTransforms.py
index 0da3670cae..8e0cbc3035 100644
--- a/contrib/tools/cython/Cython/Compiler/ParseTreeTransforms.py
+++ b/contrib/tools/cython/Cython/Compiler/ParseTreeTransforms.py
@@ -1701,7 +1701,23 @@ if VALUE is not None:
e.type.create_to_py_utility_code(env)
e.type.create_from_py_utility_code(env)
all_members_names = sorted([e.name for e in all_members])
- checksum = '0x%s' % hashlib.md5(' '.join(all_members_names).encode('utf-8')).hexdigest()[:7]
+
+ # Cython 0.x used MD5 for the checksum, which a few Python installations remove for security reasons.
+ # SHA-256 should be ok for years to come, but early Cython 3.0 alpha releases used SHA-1,
+ # which may not be.
+ checksum_algos = []
+ try:
+ checksum_algos.append(hashlib.md5)
+ except AttributeError:
+ pass
+ checksum_algos.append(hashlib.sha256)
+ checksum_algos.append(hashlib.sha1)
+
+ member_names_string = ' '.join(all_members_names).encode('utf-8')
+ checksums = [
+ '0x' + mkchecksum(member_names_string).hexdigest()[:7]
+ for mkchecksum in checksum_algos
+ ]
unpickle_func_name = '__pyx_unpickle_%s' % node.class_name
# TODO(robertwb): Move the state into the third argument
@@ -1710,9 +1726,9 @@ if VALUE is not None:
def %(unpickle_func_name)s(__pyx_type, long __pyx_checksum, __pyx_state):
cdef object __pyx_PickleError
cdef object __pyx_result
- if __pyx_checksum != %(checksum)s:
+ if __pyx_checksum not in %(checksums)s:
from pickle import PickleError as __pyx_PickleError
- raise __pyx_PickleError("Incompatible checksums (%%s vs %(checksum)s = (%(members)s))" %% __pyx_checksum)
+ raise __pyx_PickleError("Incompatible checksums (0x%%x vs %(checksums)s = (%(members)s))" %% __pyx_checksum)
__pyx_result = %(class_name)s.__new__(__pyx_type)
if __pyx_state is not None:
%(unpickle_func_name)s__set_state(<%(class_name)s> __pyx_result, __pyx_state)
@@ -1724,7 +1740,7 @@ if VALUE is not None:
__pyx_result.__dict__.update(__pyx_state[%(num_members)d])
""" % {
'unpickle_func_name': unpickle_func_name,
- 'checksum': checksum,
+ 'checksums': "(%s)" % ', '.join(checksums),
'members': ', '.join(all_members_names),
'class_name': node.class_name,
'assignments': '; '.join(
@@ -1757,7 +1773,7 @@ if VALUE is not None:
%(unpickle_func_name)s__set_state(self, __pyx_state)
""" % {
'unpickle_func_name': unpickle_func_name,
- 'checksum': checksum,
+ 'checksum': checksums[0],
'members': ', '.join('self.%s' % v for v in all_members_names) + (',' if len(all_members_names) == 1 else ''),
# Even better, we could check PyType_IS_GC.
'any_notnone_members' : ' or '.join(['self.%s is not None' % e.name for e in all_members if e.type.is_pyobject] or ['False']),
diff --git a/contrib/tools/cython/Cython/Compiler/TypeSlots.py b/contrib/tools/cython/Cython/Compiler/TypeSlots.py
index 0b4ff67042..c6867447d2 100644
--- a/contrib/tools/cython/Cython/Compiler/TypeSlots.py
+++ b/contrib/tools/cython/Cython/Compiler/TypeSlots.py
@@ -625,6 +625,20 @@ def get_slot_code_by_name(scope, slot_name):
slot = get_slot_by_name(slot_name)
return slot.slot_code(scope)
+def is_reverse_number_slot(name):
+ """
+ Tries to identify __radd__ and friends (so the METH_COEXIST flag can be applied).
+
+ There's no great consequence if it inadvertently identifies a few other methods
+ so just use a simple rule rather than an exact list.
+ """
+ if name.startswith("__r") and name.endswith("__"):
+ forward_name = name.replace("r", "", 1)
+ for meth in PyNumberMethods:
+ if getattr(meth, "method_name", None) == forward_name:
+ return True
+ return False
+
#------------------------------------------------------------------------------------------
#
diff --git a/contrib/tools/cython/Cython/Shadow.py b/contrib/tools/cython/Cython/Shadow.py
index fb662dc05c..cc8c9b60ad 100644
--- a/contrib/tools/cython/Cython/Shadow.py
+++ b/contrib/tools/cython/Cython/Shadow.py
@@ -1,7 +1,7 @@
# cython.* namespace for pure mode.
from __future__ import absolute_import
-__version__ = "0.29.28"
+__version__ = "0.29.30"
try:
from __builtin__ import basestring
@@ -305,7 +305,7 @@ class UnionType(CythonType):
setattr(self, key, value)
def __setattr__(self, key, value):
- if key in '__dict__':
+ if key == '__dict__':
CythonType.__setattr__(self, key, value)
elif key in self._members:
self.__dict__ = {key: cast(self._members[key], value)}
diff --git a/contrib/tools/cython/Cython/Utility/Coroutine.c b/contrib/tools/cython/Cython/Utility/Coroutine.c
index d26314083b..fff7eed3ec 100644
--- a/contrib/tools/cython/Cython/Utility/Coroutine.c
+++ b/contrib/tools/cython/Cython/Utility/Coroutine.c
@@ -490,6 +490,12 @@ static int __pyx_Generator_init(void); /*proto*/
#include <structmember.h>
#include <frameobject.h>
+#if PY_VERSION_HEX >= 0x030b00a6
+ #ifndef Py_BUILD_CORE
+ #define Py_BUILD_CORE 1
+ #endif
+ #error #include "internal/pycore_frame.h"
+#endif
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
diff --git a/contrib/tools/cython/Cython/Utility/CythonFunction.c b/contrib/tools/cython/Cython/Utility/CythonFunction.c
index d51b308a8d..73b51d7896 100644
--- a/contrib/tools/cython/Cython/Utility/CythonFunction.c
+++ b/contrib/tools/cython/Cython/Utility/CythonFunction.c
@@ -661,6 +661,13 @@ static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, P
self = PyTuple_GetItem(args, 0);
if (unlikely(!self)) {
Py_DECREF(new_args);
+ PyErr_Format(PyExc_TypeError,
+ "unbound method %.200s() needs an argument",
+#if PY_MAJOR_VERSION >= 3
+ cyfunc->func_qualname);
+#else
+ PyString_AsString(cyfunc->func_qualname));
+#endif
return NULL;
}
diff --git a/contrib/tools/cython/Cython/Utility/Exceptions.c b/contrib/tools/cython/Cython/Utility/Exceptions.c
index b0411f6956..1cb3657758 100644
--- a/contrib/tools/cython/Cython/Utility/Exceptions.c
+++ b/contrib/tools/cython/Cython/Utility/Exceptions.c
@@ -705,6 +705,12 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
+#if PY_VERSION_HEX >= 0x030b00a6
+ #ifndef Py_BUILD_CORE
+ #define Py_BUILD_CORE 1
+ #endif
+ #error #include "internal/pycore_frame.h"
+#endif
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
@@ -772,6 +778,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
PyCodeObject *py_code = 0;
PyFrameObject *py_frame = 0;
PyThreadState *tstate = __Pyx_PyThreadState_Current;
+ PyObject *ptype, *pvalue, *ptraceback;
if (c_line) {
c_line = __Pyx_CLineForTraceback(tstate, c_line);
@@ -780,9 +787,18 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
// Negate to avoid collisions between py and c lines.
py_code = $global_code_object_cache_find(c_line ? -c_line : py_line);
if (!py_code) {
+ __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
- if (!py_code) goto bad;
+ if (!py_code) {
+ /* If the code object creation fails, then we should clear the
+ fetched exception references and propagate the new exception */
+ Py_XDECREF(ptype);
+ Py_XDECREF(pvalue);
+ Py_XDECREF(ptraceback);
+ goto bad;
+ }
+ __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
$global_code_object_cache_insert(c_line ? -c_line : py_line, py_code);
}
py_frame = PyFrame_New(
diff --git a/contrib/tools/cython/Cython/Utility/ExtensionTypes.c b/contrib/tools/cython/Cython/Utility/ExtensionTypes.c
index 0d8c41dee1..dc187ab49e 100644
--- a/contrib/tools/cython/Cython/Utility/ExtensionTypes.c
+++ b/contrib/tools/cython/Cython/Utility/ExtensionTypes.c
@@ -204,18 +204,37 @@ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
static int __Pyx_setup_reduce(PyObject* type_obj) {
int ret = 0;
PyObject *object_reduce = NULL;
+ PyObject *object_getstate = NULL;
PyObject *object_reduce_ex = NULL;
PyObject *reduce = NULL;
PyObject *reduce_ex = NULL;
PyObject *reduce_cython = NULL;
PyObject *setstate = NULL;
PyObject *setstate_cython = NULL;
+ PyObject *getstate = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
- if (_PyType_Lookup((PyTypeObject*)type_obj, PYIDENT("__getstate__"))) goto __PYX_GOOD;
+ getstate = _PyType_Lookup((PyTypeObject*)type_obj, PYIDENT("__getstate__"));
#else
- if (PyObject_HasAttr(type_obj, PYIDENT("__getstate__"))) goto __PYX_GOOD;
+ getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, PYIDENT("__getstate__"));
+ if (!getstate && PyErr_Occurred()) {
+ goto __PYX_BAD;
+ }
#endif
+ if (getstate) {
+ // Python 3.11 introduces object.__getstate__. Because it's version-specific failure to find it should not be an error
+#if CYTHON_USE_PYTYPE_LOOKUP
+ object_getstate = _PyType_Lookup(&PyBaseObject_Type, PYIDENT("__getstate__"));
+#else
+ object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, PYIDENT("__getstate__"));
+ if (!object_getstate && PyErr_Occurred()) {
+ goto __PYX_BAD;
+ }
+#endif
+ if (object_getstate != getstate) {
+ goto __PYX_GOOD;
+ }
+ }
#if CYTHON_USE_PYTYPE_LOOKUP
object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, PYIDENT("__reduce_ex__")); if (!object_reduce_ex) goto __PYX_BAD;
@@ -270,6 +289,8 @@ __PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
Py_XDECREF(object_reduce);
Py_XDECREF(object_reduce_ex);
+ Py_XDECREF(object_getstate);
+ Py_XDECREF(getstate);
#endif
Py_XDECREF(reduce);
Py_XDECREF(reduce_ex);
diff --git a/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c b/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c
index 21c43cb330..b653001899 100644
--- a/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c
+++ b/contrib/tools/cython/Cython/Utility/ModuleSetupCode.c
@@ -93,6 +93,9 @@
#define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900)
+ #endif
#elif defined(PYSTON_VERSION)
#define CYTHON_COMPILING_IN_PYPY 0
@@ -136,6 +139,9 @@
#define CYTHON_USE_DICT_VERSIONS 0
#undef CYTHON_USE_EXC_INFO_STACK
#define CYTHON_USE_EXC_INFO_STACK 0
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
+ #endif
#else
#define CYTHON_COMPILING_IN_PYPY 0
@@ -196,7 +202,8 @@
#ifndef CYTHON_FAST_PYCALL
// Python 3.11 deleted localplus argument from frame object, which is used in our
// fast_pycall code
- #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1)
+ // On Python 3.10 it causes issues when used while profiling/debugging
+ #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
#endif
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
@@ -213,6 +220,9 @@
#elif !defined(CYTHON_USE_EXC_INFO_STACK)
#define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
#endif
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
+ #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
@@ -1223,11 +1233,37 @@ static int __Pyx_check_binary_version(void);
/////////////// CheckBinaryVersion ///////////////
static int __Pyx_check_binary_version(void) {
- char ctversion[4], rtversion[4];
- PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
- PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
- if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
+ char ctversion[5];
+ int same=1, i, found_dot;
+ const char* rt_from_call = Py_GetVersion();
+ PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
+ // slightly convoluted, but now that we're into double digit version numbers we can no longer just rely on the length.
+ found_dot = 0;
+ for (i = 0; i < 4; i++) {
+ if (!ctversion[i]) {
+ // if they are the same, just check that the runtime version doesn't continue with further numbers
+ same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
+ break;
+ }
+ if (rt_from_call[i] != ctversion[i]) {
+ same = 0;
+ break;
+ }
+ }
+
+ if (!same) {
+ char rtversion[5] = {'\0'};
+ // copy the runtime-version for the error message
char message[200];
+ for (i=0; i<4; ++i) {
+ if (rt_from_call[i] == '.') {
+ if (found_dot) break;
+ found_dot = 1;
+ } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
+ break;
+ }
+ rtversion[i] = rt_from_call[i];
+ }
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
diff --git a/contrib/tools/cython/Cython/Utility/ObjectHandling.c b/contrib/tools/cython/Cython/Utility/ObjectHandling.c
index c1b1c60bda..545fbac570 100644
--- a/contrib/tools/cython/Cython/Utility/ObjectHandling.c
+++ b/contrib/tools/cython/Cython/Utility/ObjectHandling.c
@@ -1996,6 +1996,13 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
static size_t __pyx_pyframe_localsplus_offset = 0;
#include "frameobject.h"
+#if PY_VERSION_HEX >= 0x030b00a6
+ #ifndef Py_BUILD_CORE
+ #define Py_BUILD_CORE 1
+ #endif
+ #error #include "internal/pycore_frame.h"
+#endif
+
// This is the long runtime version of
// #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
// offsetof(PyFrameObject, f_localsplus) differs between regular C-Python and Stackless Python.
diff --git a/contrib/tools/cython/Cython/Utility/Profile.c b/contrib/tools/cython/Cython/Utility/Profile.c
index 921eb67529..f979932e4a 100644
--- a/contrib/tools/cython/Cython/Utility/Profile.c
+++ b/contrib/tools/cython/Cython/Utility/Profile.c
@@ -38,6 +38,12 @@
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
+#if PY_VERSION_HEX >= 0x030b00a6
+ #ifndef Py_BUILD_CORE
+ #define Py_BUILD_CORE 1
+ #endif
+ #error #include "internal/pycore_frame.h"
+#endif
#if CYTHON_PROFILE_REUSE_FRAME
#define CYTHON_FRAME_MODIFIER static
diff --git a/contrib/tools/cython/Cython/Utility/StringTools.c b/contrib/tools/cython/Cython/Utility/StringTools.c
index 2fdae812a0..f6043e5fa4 100644
--- a/contrib/tools/cython/Cython/Utility/StringTools.c
+++ b/contrib/tools/cython/Cython/Utility/StringTools.c
@@ -314,7 +314,7 @@ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int eq
return (equals == Py_EQ);
} else {
int result;
-#if CYTHON_USE_UNICODE_INTERNALS
+#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
Py_hash_t hash1, hash2;
hash1 = ((PyBytesObject*)s1)->ob_shash;
hash2 = ((PyBytesObject*)s2)->ob_shash;
diff --git a/contrib/tools/cython/cython.py b/contrib/tools/cython/cython.py
index 6603fdcce4..8e074408f0 100755
--- a/contrib/tools/cython/cython.py
+++ b/contrib/tools/cython/cython.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-# Change content of this file to change uids for cython programs - cython 0.29.28 r0
+# Change content of this file to change uids for cython programs - cython 0.29.30 r0
#
# Cython -- Main Program, generic