Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-Cython for openSUSE:Factory checked in at 2021-07-17 23:36:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Cython (Old) and /work/SRC/openSUSE:Factory/.python-Cython.new.2632 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Cython" Sat Jul 17 23:36:22 2021 rev:60 rq:906304 version:0.29.24 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Cython/python-Cython.changes 2021-04-24 23:06:38.571181817 +0200 +++ /work/SRC/openSUSE:Factory/.python-Cython.new.2632/python-Cython.changes 2021-07-17 23:36:26.162063478 +0200 @@ -1,0 +2,19 @@ +Wed Jul 14 08:28:08 UTC 2021 - Paolo Stivanin <i...@paolostivanin.com> + +- Update to 0.29.24: + * Inline functions in pxd files that used memory views could lead to invalid + C code if the module that imported from them does not use memory views. + * Several declarations in ``libcpp.string`` were added and corrected. + * Pickling unbound Cython compiled methods failed. + * The tracing code was adapted to work with CPython 3.10. + * The optimised ``in`` operator failed on unicode strings in Py3.9 and later + that were constructed from an external ``wchar_t`` source. + Also, related C compiler warnings about deprecated C-API usage were resolved. + * Some compiler crashes were resolved. + * An incorrect warning about 'unused' generator expressions was removed. + * The attributes ``gen.gi_frame`` and ``coro.cr_frame`` of Cython compiled + generators and coroutines now return an actual frame object for introspection, + instead of ``None``. +- Drop cython_use_imgmath.patch + +------------------------------------------------------------------- Old: ---- Cython-0.29.23.tar.gz cython_use_imgmath.patch New: ---- Cython-0.29.24.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Cython.spec ++++++ --- /var/tmp/diff_new_pack.jHUCcA/_old 2021-07-17 23:36:26.594060148 +0200 +++ /var/tmp/diff_new_pack.jHUCcA/_new 2021-07-17 23:36:26.598060117 +0200 @@ -19,15 +19,13 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python Name: python-Cython -Version: 0.29.23 +Version: 0.29.24 Release: 0 Summary: The Cython compiler for writing C extensions for the Python language License: Apache-2.0 URL: http://www.cython.org Source: https://files.pythonhosted.org/packages/source/C/Cython/Cython-%{version}.tar.gz Source1: python-Cython-rpmlintrc -# PATCH-FIX-UPSTREAM -- cython_use_imgmath.patch -- Don't use removed pngmath Sphinx extension -- gh#cython/cython#2818 -Patch0: cython_use_imgmath.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module xml} BuildRequires: fdupes @@ -55,7 +53,6 @@ %prep %setup -q -n Cython-%{version} -%patch0 -p1 # Fix non-executable scripts sed -i "s|^#!.*||" Cython/Debugger/{libpython,Cygdb}.py cython.py ++++++ Cython-0.29.23.tar.gz -> Cython-0.29.24.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/.gitrev new/Cython-0.29.24/.gitrev --- old/Cython-0.29.23/.gitrev 2021-04-14 17:25:18.000000000 +0200 +++ new/Cython-0.29.24/.gitrev 2021-07-13 22:40:59.000000000 +0200 @@ -1 +1 @@ -17670781083e3ccfedb1af4adcec614d4599eef9 +3a34c5fb48ee86be9d0a819fee1ff3cb3efd1a1e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/CHANGES.rst new/Cython-0.29.24/CHANGES.rst --- old/Cython-0.29.23/CHANGES.rst 2021-04-14 17:24:45.000000000 +0200 +++ new/Cython-0.29.24/CHANGES.rst 2021-07-13 22:36:58.000000000 +0200 @@ -2,6 +2,41 @@ Cython Changelog ================ +0.29.24 (2021-07-14) +==================== + +Bugs fixed +---------- + +* Inline functions in pxd files that used memory views could lead to invalid + C code if the module that imported from them does not use memory views. + Patch by David Woods. (Github issue #1415) + +* Several declarations in ``libcpp.string`` were added and corrected. + Patch by Janek Bevendorff. (Github issue #4268) + +* Pickling unbound Cython compiled methods failed. + Patch by Pierre Glaser. (Github issue #2972) + +* The tracing code was adapted to work with CPython 3.10. + +* The optimised ``in`` operator failed on unicode strings in Py3.9 and later + that were constructed from an external ``wchar_t`` source. + Also, related C compiler warnings about deprecated C-API usage were resolved. + (Github issue #3925) + +* Some compiler crashes were resolved. + Patch by David Woods. (Github issues #4214, #2811) + +* An incorrect warning about 'unused' generator expressions was removed. + (GIthub issue #1699) + +* The attributes ``gen.gi_frame`` and ``coro.cr_frame`` of Cython compiled + generators and coroutines now return an actual frame object for introspection, + instead of ``None``. + (Github issue #2306) + + 0.29.23 (2021-04-14) ==================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Compiler/ExprNodes.py new/Cython-0.29.24/Cython/Compiler/ExprNodes.py --- old/Cython-0.29.23/Cython/Compiler/ExprNodes.py 2021-04-14 17:24:45.000000000 +0200 +++ new/Cython-0.29.24/Cython/Compiler/ExprNodes.py 2021-07-13 22:36:45.000000000 +0200 @@ -12972,12 +12972,11 @@ CoercionNode.__init__(self, arg) self.type = dst_type self.is_temp = 1 - self.env = env self.use_managed_ref = True self.arg = arg + self.type.create_from_py_utility_code(env) def generate_result_code(self, code): - self.type.create_from_py_utility_code(self.env) code.putln(self.type.from_py_call_code( self.arg.py_result(), self.result(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Compiler/ModuleNode.py new/Cython-0.29.24/Cython/Compiler/ModuleNode.py --- old/Cython-0.29.23/Cython/Compiler/ModuleNode.py 2021-04-14 17:24:45.000000000 +0200 +++ new/Cython-0.29.24/Cython/Compiler/ModuleNode.py 2021-07-13 22:36:58.000000000 +0200 @@ -2406,11 +2406,10 @@ code.put_error_if_neg(self.pos, "_import_array()") code.putln("/*--- Threads initialization code ---*/") - code.putln("#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS") - code.putln("#ifdef WITH_THREAD /* Python build with threading support? */") + code.putln("#if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 " + "&& defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS") code.putln("PyEval_InitThreads();") code.putln("#endif") - code.putln("#endif") code.putln("/*--- Module creation code ---*/") self.generate_module_creation_code(env, code) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Compiler/Nodes.py new/Cython-0.29.24/Cython/Compiler/Nodes.py --- old/Cython-0.29.23/Cython/Compiler/Nodes.py 2021-02-19 21:31:16.000000000 +0100 +++ new/Cython-0.29.24/Cython/Compiler/Nodes.py 2021-07-13 22:36:45.000000000 +0200 @@ -4156,6 +4156,10 @@ cname=cname, visibility='private') entry.func_cname = cname entry.qualified_name = EncodedString(self.name) + # Work-around for https://github.com/cython/cython/issues/1699 + # We don't currently determine whether the generator entry is used or not, + # so mark it as used to avoid false warnings. + entry.used = True self.entry = entry def analyse_declarations(self, env): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Compiler/Symtab.py new/Cython-0.29.24/Cython/Compiler/Symtab.py --- old/Cython-0.29.23/Cython/Compiler/Symtab.py 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/Cython/Compiler/Symtab.py 2021-07-13 22:36:58.000000000 +0200 @@ -822,6 +822,7 @@ if overridable: # names of cpdef functions can be used as variables and can be assigned to var_entry = Entry(name, cname, py_object_type) # FIXME: cname? + var_entry.qualified_name = self.qualify_name(name) var_entry.is_variable = 1 var_entry.is_pyglobal = 1 var_entry.scope = entry.scope @@ -1034,6 +1035,7 @@ else: python_equiv = EncodedString(python_equiv) var_entry = Entry(python_equiv, python_equiv, py_object_type) + var_entry.qualified_name = self.qualify_name(name) var_entry.is_variable = 1 var_entry.is_builtin = 1 var_entry.utility_code = utility_code @@ -1057,6 +1059,7 @@ type = self.lookup('type').type, # make sure "type" is the first type declared... pos = entry.pos, cname = entry.type.typeptr_cname) + var_entry.qualified_name = self.qualify_name(name) var_entry.is_variable = 1 var_entry.is_cglobal = 1 var_entry.is_readonly = 1 @@ -1244,6 +1247,7 @@ else: entry.is_builtin = 1 entry.name = name + entry.qualified_name = self.builtin_scope().qualify_name(name) return entry def find_module(self, module_name, pos, relative_level=-1): @@ -1707,6 +1711,7 @@ type = Builtin.type_type, pos = entry.pos, cname = entry.type.typeptr_cname) + var_entry.qualified_name = entry.qualified_name var_entry.is_variable = 1 var_entry.is_cglobal = 1 var_entry.is_readonly = 1 @@ -2290,6 +2295,7 @@ entry = self.declare_cfunction(name, type, None, cname, visibility='extern', utility_code=utility_code) var_entry = Entry(name, name, py_object_type) + var_entry.qualified_name = name var_entry.is_variable = 1 var_entry.is_builtin = 1 var_entry.utility_code = utility_code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Includes/libcpp/string.pxd new/Cython-0.29.24/Cython/Includes/libcpp/string.pxd --- old/Cython-0.29.23/Cython/Includes/libcpp/string.pxd 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/Cython/Includes/libcpp/string.pxd 2021-07-13 22:36:58.000000000 +0200 @@ -2,27 +2,21 @@ # deprecated cimport for backwards compatibility: from libc.string cimport const_char +cdef extern from "<string>" namespace "std::string" nogil: + const size_t npos cdef extern from "<string>" namespace "std" nogil: - - size_t npos = -1 - cdef cppclass string: - string() except + - string(const char *) except + - string(const char *, size_t) except + - string(const string&) except + - # as a string formed by a repetition of character c, n times. - string(size_t, char) except + cppclass iterator: iterator() char& operator*() - iterator(iterator &) + iterator(iterator&) iterator operator++() iterator operator--() bint operator==(iterator) bint operator!=(iterator) + cppclass reverse_iterator: char& operator*() iterator operator++() @@ -35,11 +29,22 @@ bint operator>(reverse_iterator) bint operator<=(reverse_iterator) bint operator>=(reverse_iterator) + cppclass const_iterator(iterator): pass + cppclass const_reverse_iterator(reverse_iterator): pass + string() except + + string(const string& s) except + + string(const string& s, size_t pos) except + + string(const string& s, size_t pos, size_t len) except + + string(const char* s) except + + string(const char* s, size_t n) except + + string(size_t n, char c) except + + string(iterator first, iterator last) except + + iterator begin() const_iterator const_begin "begin"() iterator end() @@ -54,96 +59,123 @@ size_t size() size_t max_size() size_t length() - void resize(size_t) - void resize(size_t, char c) + void resize(size_t) except + + void resize(size_t, char) except + + void shrink_to_fit() except + size_t capacity() - void reserve(size_t) + void reserve(size_t) except + void clear() bint empty() - char& at(size_t) - char& operator[](size_t) - char& front() # C++11 - char& back() # C++11 - int compare(const string&) - - string& append(const string&) - string& append(const string&, size_t, size_t) - string& append(const char *) - string& append(const char *, size_t) - string& append(size_t, char) - - void push_back(char c) - - string& assign (const string&) - string& assign (const string&, size_t, size_t) - string& assign (const char *, size_t) - string& assign (const char *) - string& assign (size_t n, char c) - - string& insert(size_t, const string&) - string& insert(size_t, const string&, size_t, size_t) - string& insert(size_t, const char* s, size_t) - - - string& insert(size_t, const char* s) - string& insert(size_t, size_t, char c) - - size_t copy(char *, size_t, size_t) - - size_t find(const string&) - size_t find(const string&, size_t) - size_t find(const char*, size_t pos, size_t) - size_t find(const char*, size_t pos) - size_t find(char, size_t pos) - - size_t rfind(const string&, size_t) - size_t rfind(const char* s, size_t, size_t) - size_t rfind(const char*, size_t pos) - size_t rfind(char c, size_t) + iterator erase(iterator first, iterator last) + iterator erase(iterator p) + iterator erase(const_iterator first, const_iterator last) + iterator erase(const_iterator p) + string& erase(size_t pos, size_t len) except + + string& erase(size_t pos) except + + string& erase() except + + + char& at(size_t pos) except + + char& operator[](size_t pos) + char& front() + char& back() + int compare(const string& s) + int compare(size_t pos, size_t len, const string& s) except + + int compare(size_t pos, size_t len, const string& s, size_t subpos, size_t sublen) except + + int compare(const char* s) except + + int compare(size_t pos, size_t len, const char* s) except + + int compare(size_t pos, size_t len, const char* s , size_t n) except + + + string& append(const string& s) except + + string& append(const string& s, size_t subpos, size_t sublen) except + + string& append(const char* s) except + + string& append(const char* s, size_t n) except + + string& append(size_t n, char c) except + + + void push_back(char c) except + + void pop_back() + + string& assign(const string& s) except + + string& assign(const string& s, size_t subpos, size_t sublen) except + + string& assign(const char* s, size_t n) except + + string& assign(const char* s) except + + string& assign(size_t n, char c) except + + + string& insert(size_t pos, const string& s, size_t subpos, size_t sublen) except + + string& insert(size_t pos, const string& s) except + + string& insert(size_t pos, const char* s, size_t n) except + + string& insert(size_t pos, const char* s) except + + string& insert(size_t pos, size_t n, char c) except + + void insert(iterator p, size_t n, char c) except + + iterator insert(iterator p, char c) except + + + size_t copy(char* s, size_t len, size_t pos) except + + size_t copy(char* s, size_t len) except + + + size_t find(const string& s, size_t pos) + size_t find(const string& s) + size_t find(const char* s, size_t pos, size_t n) + size_t find(const char* s, size_t pos) + size_t find(const char* s) + size_t find(char c, size_t pos) + size_t find(char c) + + size_t rfind(const string&, size_t pos) + size_t rfind(const string&) + size_t rfind(const char* s, size_t pos, size_t n) + size_t rfind(const char* s, size_t pos) + size_t rfind(const char* s) + size_t rfind(char c, size_t pos) size_t rfind(char c) - size_t find_first_of(const string&, size_t) - size_t find_first_of(const char* s, size_t, size_t) - size_t find_first_of(const char*, size_t pos) - size_t find_first_of(char c, size_t) + size_t find_first_of(const string&, size_t pos) + size_t find_first_of(const string&) + size_t find_first_of(const char* s, size_t pos, size_t n) + size_t find_first_of(const char* s, size_t pos) + size_t find_first_of(const char* s) + size_t find_first_of(char c, size_t pos) size_t find_first_of(char c) - size_t find_first_not_of(const string&, size_t) - size_t find_first_not_of(const char* s, size_t, size_t) - size_t find_first_not_of(const char*, size_t pos) - size_t find_first_not_of(char c, size_t) + size_t find_first_not_of(const string& s, size_t pos) + size_t find_first_not_of(const string& s) + size_t find_first_not_of(const char* s, size_t pos, size_t n) + size_t find_first_not_of(const char* s, size_t pos) + size_t find_first_not_of(const char*) + size_t find_first_not_of(char c, size_t pos) size_t find_first_not_of(char c) - size_t find_last_of(const string&, size_t) - size_t find_last_of(const char* s, size_t, size_t) - size_t find_last_of(const char*, size_t pos) - size_t find_last_of(char c, size_t) + size_t find_last_of(const string& s, size_t pos) + size_t find_last_of(const string& s) + size_t find_last_of(const char* s, size_t pos, size_t n) + size_t find_last_of(const char* s, size_t pos) + size_t find_last_of(const char* s) + size_t find_last_of(char c, size_t pos) size_t find_last_of(char c) - size_t find_last_not_of(const string&, size_t) - size_t find_last_not_of(const char* s, size_t, size_t) - size_t find_last_not_of(const char*, size_t pos) + size_t find_last_not_of(const string& s, size_t pos) + size_t find_last_not_of(const string& s) + size_t find_last_not_of(const char* s, size_t pos, size_t n) + size_t find_last_not_of(const char* s, size_t pos) + size_t find_last_not_of(const char* s) + size_t find_last_not_of(char c, size_t pos) + size_t find_last_not_of(char c) - string substr(size_t, size_t) + string substr(size_t pos, size_t len) except + + string substr(size_t pos) except + string substr() - string substr(size_t) - - size_t find_last_not_of(char c, size_t) - size_t find_last_not_of(char c) #string& operator= (const string&) #string& operator= (const char*) #string& operator= (char) - string operator+ (const string& rhs) - string operator+ (const char* rhs) + string operator+ (const string&) except + + string operator+ (const char*) except + bint operator==(const string&) bint operator==(const char*) - bint operator!= (const string& rhs ) - bint operator!= (const char* ) + bint operator!= (const string&) + bint operator!= (const char*) bint operator< (const string&) bint operator< (const char*) @@ -156,3 +188,40 @@ bint operator>= (const string&) bint operator>= (const char*) + + + string to_string(int val) except + + string to_string(long val) except + + string to_string(long long val) except + + string to_string(unsigned val) except + + string to_string(size_t val) except + + string to_string(ssize_t val) except + + string to_string(unsigned long val) except + + string to_string(unsigned long long val) except + + string to_string(float val) except + + string to_string(double val) except + + string to_string(long double val) except + + + int stoi(const string& s, size_t* idx, int base) except + + int stoi(const string& s, size_t* idx) except + + int stoi(const string& s) except + + long stol(const string& s, size_t* idx, int base) except + + long stol(const string& s, size_t* idx) except + + long stol(const string& s) except + + long long stoll(const string& s, size_t* idx, int base) except + + long long stoll(const string& s, size_t* idx) except + + long long stoll(const string& s) except + + + unsigned long stoul(const string& s, size_t* idx, int base) except + + unsigned long stoul(const string& s, size_t* idx) except + + unsigned long stoul(const string& s) except + + unsigned long long stoull(const string& s, size_t* idx, int base) except + + unsigned long long stoull(const string& s, size_t* idx) except + + unsigned long long stoull(const string& s) except + + + float stof(const string& s, size_t* idx) except + + float stof(const string& s) except + + double stod(const string& s, size_t* idx) except + + double stod(const string& s) except + + long double stold(const string& s, size_t* idx) except + + long double stold(const string& s) except + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Shadow.py new/Cython-0.29.24/Cython/Shadow.py --- old/Cython-0.29.23/Cython/Shadow.py 2021-04-14 17:24:45.000000000 +0200 +++ new/Cython-0.29.24/Cython/Shadow.py 2021-07-13 22:36:58.000000000 +0200 @@ -1,7 +1,7 @@ # cython.* namespace for pure mode. from __future__ import absolute_import -__version__ = "0.29.23" +__version__ = "0.29.24" try: from __builtin__ import basestring diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Utility/Builtins.c new/Cython-0.29.24/Cython/Utility/Builtins.c --- old/Cython-0.29.23/Cython/Utility/Builtins.c 2021-04-14 17:24:45.000000000 +0200 +++ new/Cython-0.29.24/Cython/Utility/Builtins.c 2021-07-13 22:36:45.000000000 +0200 @@ -333,7 +333,7 @@ } else { // FIXME: support character buffers - but CPython doesn't support them either PyErr_Format(PyExc_TypeError, - "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name); + "ord() expected string of length 1, but %.200s found", Py_TYPE(c)->tp_name); return (long)(Py_UCS4)-1; } PyErr_Format(PyExc_TypeError, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Utility/Coroutine.c new/Cython-0.29.24/Cython/Utility/Coroutine.c --- old/Cython-0.29.23/Cython/Utility/Coroutine.c 2021-02-19 21:31:16.000000000 +0100 +++ new/Cython-0.29.24/Cython/Utility/Coroutine.c 2021-07-13 22:36:45.000000000 +0200 @@ -388,6 +388,7 @@ PyObject *gi_qualname; PyObject *gi_modulename; PyObject *gi_code; + PyObject *gi_frame; int resume_label; // using T_BOOL for property below requires char value char is_running; @@ -1137,6 +1138,7 @@ } #endif Py_CLEAR(gen->gi_code); + Py_CLEAR(gen->gi_frame); Py_CLEAR(gen->gi_name); Py_CLEAR(gen->gi_qualname); Py_CLEAR(gen->gi_modulename); @@ -1157,7 +1159,7 @@ if (PyObject_CallFinalizerFromDealloc(self)) #else Py_TYPE(gen)->tp_del(self); - if (self->ob_refcnt > 0) + if (Py_REFCNT(self) > 0) #endif { // resurrected. :( @@ -1272,7 +1274,7 @@ #if !CYTHON_USE_TP_FINALIZE // Undo the temporary resurrection; can't use DECREF here, it would // cause a recursive call. - assert(self->ob_refcnt > 0); + assert(Py_REFCNT(self) > 0); if (--self->ob_refcnt == 0) { // this is the normal path out return; @@ -1281,12 +1283,12 @@ // close() resurrected it! Make it look like the original Py_DECREF // never happened. { - Py_ssize_t refcnt = self->ob_refcnt; + Py_ssize_t refcnt = Py_REFCNT(self); _Py_NewReference(self); __Pyx_SET_REFCNT(self, refcnt); } #if CYTHON_COMPILING_IN_CPYTHON - assert(PyType_IS_GC(self->ob_type) && + assert(PyType_IS_GC(Py_TYPE(self)) && _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); // If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so @@ -1369,6 +1371,31 @@ return 0; } + +static PyObject * +__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context) +{ + PyObject *frame = self->gi_frame; + if (!frame) { + if (unlikely(!self->gi_code)) { + // Avoid doing something stupid, e.g. during garbage collection. + Py_RETURN_NONE; + } + frame = (PyObject *) PyFrame_New( + PyThreadState_Get(), /*PyThreadState *tstate,*/ + (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/ + $moddict_cname, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (unlikely(!frame)) + return NULL; + // keep the frame cached once it's created + self->gi_frame = frame; + } + Py_INCREF(frame); + return frame; +} + static __pyx_CoroutineObject *__Pyx__Coroutine_New( PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, PyObject *name, PyObject *qualname, PyObject *module_name) { @@ -1403,6 +1430,7 @@ gen->gi_modulename = module_name; Py_XINCREF(code); gen->gi_code = code; + gen->gi_frame = NULL; PyObject_GC_Track(gen); return gen; @@ -1558,13 +1586,6 @@ } #endif -static PyObject * -__Pyx_Coroutine_get_frame(CYTHON_UNUSED __pyx_CoroutineObject *self, CYTHON_UNUSED void *context) -{ - // Fake implementation that always returns None, but at least does not raise an AttributeError. - Py_RETURN_NONE; -} - #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 static PyObject *__Pyx_Coroutine_compare(PyObject *obj, PyObject *other, int op) { PyObject* result; @@ -1844,6 +1865,8 @@ (char*) PyDoc_STR("name of the generator"), 0}, {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, (char*) PyDoc_STR("qualified name of the generator"), 0}, + {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL, + (char*) PyDoc_STR("Frame of the generator"), 0}, {0, 0, 0, 0, 0} }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Utility/CythonFunction.c new/Cython-0.29.24/Cython/Utility/CythonFunction.c --- old/Cython-0.29.23/Cython/Utility/CythonFunction.c 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/Cython/Utility/CythonFunction.c 2021-07-13 22:36:45.000000000 +0200 @@ -426,7 +426,8 @@ __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) { #if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); + Py_INCREF(m->func_qualname); + return m->func_qualname; #else return PyString_FromString(m->func.m_ml->ml_name); #endif @@ -1135,7 +1136,7 @@ PyErr_Format(PyExc_TypeError, "First argument should be of type %.200s, got %.200s.", ((PyTypeObject *) binding_func->type)->tp_name, - self->ob_type->tp_name); + Py_TYPE(self)->tp_name); goto bad; } else if (unlikely(is_instance == -1)) { goto bad; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Utility/ModuleSetupCode.c new/Cython-0.29.24/Cython/Utility/ModuleSetupCode.c --- old/Cython-0.29.23/Cython/Utility/ModuleSetupCode.c 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/Cython/Utility/ModuleSetupCode.c 2021-07-13 22:36:58.000000000 +0200 @@ -523,8 +523,15 @@ /* new Py3.3 unicode type (PEP 393) */ #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 + + #if defined(PyUnicode_IS_READY) #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) + #else + // Py3.12 / PEP-623 will remove wstr type unicode strings and all of the PyUnicode_READY() machinery. + #define __Pyx_PyUnicode_READY(op) (0) + #endif + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) @@ -533,7 +540,13 @@ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + // Avoid calling deprecated C-API functions in Py3.9+ that PEP-623 schedules for removal in Py3.12. + // https://www.python.org/dev/peps/pep-0623/ + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #endif @@ -909,7 +922,7 @@ /////////////// InitThreads.init /////////////// -#ifdef WITH_THREAD +#if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 PyEval_InitThreads(); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Utility/ObjectHandling.c new/Cython-0.29.24/Cython/Utility/ObjectHandling.c --- old/Cython-0.29.23/Cython/Utility/ObjectHandling.c 2021-02-19 21:31:16.000000000 +0100 +++ new/Cython-0.29.24/Cython/Utility/ObjectHandling.c 2021-07-13 22:36:45.000000000 +0200 @@ -1040,7 +1040,7 @@ /////////////// CallableCheck.proto /////////////// #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) +#define __Pyx_PyCallable_Check(obj) (Py_TYPE(obj)->tp_call != NULL) #else #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) #endif @@ -1913,7 +1913,7 @@ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; - ternaryfunc call = func->ob_type->tp_call; + ternaryfunc call = Py_TYPE(func)->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Utility/Profile.c new/Cython-0.29.24/Cython/Utility/Profile.c --- old/Cython-0.29.23/Cython/Utility/Profile.c 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/Cython/Utility/Profile.c 2021-07-13 22:36:45.000000000 +0200 @@ -47,13 +47,32 @@ #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame) #endif - #define __Pyx_TraceDeclarations \ - static PyCodeObject *$frame_code_cname = NULL; \ - CYTHON_FRAME_MODIFIER PyFrameObject *$frame_cname = NULL; \ - int __Pyx_use_tracing = 0; + #define __Pyx_TraceDeclarations \ + static PyCodeObject *$frame_code_cname = NULL; \ + CYTHON_FRAME_MODIFIER PyFrameObject *$frame_cname = NULL; \ + int __Pyx_use_tracing = 0; + + #define __Pyx_TraceFrameInit(codeobj) \ + if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj; + +#if PY_VERSION_HEX >= 0x030a00b1 + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \ + (unlikely((tstate)->cframe->use_tracing) && \ + (!(check_tracing) || !(tstate)->tracing) && \ + (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) - #define __Pyx_TraceFrameInit(codeobj) \ - if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj; + #define __Pyx_SetTracing(tstate, enable) \ + (tstate)->cframe->use_tracing = (enable) + +#else + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \ + (unlikely((tstate)->use_tracing) && \ + (!(check_tracing) || !(tstate)->tracing) && \ + (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) + + #define __Pyx_SetTracing(tstate, enable) \ + (tstate)->use_tracing = (enable) +#endif #ifdef WITH_THREAD #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) \ @@ -62,8 +81,7 @@ PyThreadState *tstate; \ PyGILState_STATE state = PyGILState_Ensure(); \ tstate = __Pyx_PyThreadState_Current; \ - if (unlikely(tstate->use_tracing) && !tstate->tracing && \ - (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ + if (__Pyx_IsTracing(tstate, 1, 1)) { \ __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \ } \ PyGILState_Release(state); \ @@ -71,8 +89,7 @@ } \ } else { \ PyThreadState* tstate = PyThreadState_GET(); \ - if (unlikely(tstate->use_tracing) && !tstate->tracing && \ - (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ + if (__Pyx_IsTracing(tstate, 1, 1)) { \ __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \ if (unlikely(__Pyx_use_tracing < 0)) goto_error; \ } \ @@ -80,8 +97,7 @@ #else #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) \ { PyThreadState* tstate = PyThreadState_GET(); \ - if (unlikely(tstate->use_tracing) && !tstate->tracing && \ - (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ + if (__Pyx_IsTracing(tstate, 1, 1)) { \ __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&$frame_code_cname, &$frame_cname, tstate, funcname, srcfile, firstlineno); \ if (unlikely(__Pyx_use_tracing < 0)) goto_error; \ } \ @@ -91,10 +107,9 @@ #define __Pyx_TraceException() \ if (likely(!__Pyx_use_tracing)); else { \ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ - if (tstate->use_tracing && \ - (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))) { \ + if (__Pyx_IsTracing(tstate, 0, 1)) { \ tstate->tracing++; \ - tstate->use_tracing = 0; \ + __Pyx_SetTracing(tstate, 0); \ PyObject *exc_info = __Pyx_GetExceptionTuple(tstate); \ if (exc_info) { \ if (CYTHON_TRACE && tstate->c_tracefunc) \ @@ -104,7 +119,7 @@ tstate->c_profileobj, $frame_cname, PyTrace_EXCEPTION, exc_info); \ Py_DECREF(exc_info); \ } \ - tstate->use_tracing = 1; \ + __Pyx_SetTracing(tstate, 1); \ tstate->tracing--; \ } \ } @@ -113,13 +128,13 @@ PyObject *type, *value, *traceback; __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); tstate->tracing++; - tstate->use_tracing = 0; + __Pyx_SetTracing(tstate, 0); if (CYTHON_TRACE && tstate->c_tracefunc) tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result); if (tstate->c_profilefunc) tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result); CYTHON_FRAME_DEL(frame); - tstate->use_tracing = 1; + __Pyx_SetTracing(tstate, 1); tstate->tracing--; __Pyx_ErrRestoreInState(tstate, type, value, traceback); } @@ -132,14 +147,14 @@ PyThreadState *tstate; \ PyGILState_STATE state = PyGILState_Ensure(); \ tstate = __Pyx_PyThreadState_Current; \ - if (tstate->use_tracing) { \ + if (__Pyx_IsTracing(tstate, 0, 0)) { \ __Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \ } \ PyGILState_Release(state); \ } \ } else { \ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ - if (tstate->use_tracing) { \ + if (__Pyx_IsTracing(tstate, 0, 0)) { \ __Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \ } \ } \ @@ -148,7 +163,7 @@ #define __Pyx_TraceReturn(result, nogil) \ if (likely(!__Pyx_use_tracing)); else { \ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ - if (tstate->use_tracing) { \ + if (__Pyx_IsTracing(tstate, 0, 0)) { \ __Pyx_call_return_trace_func(tstate, $frame_cname, (PyObject*)result); \ } \ } @@ -176,9 +191,11 @@ __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); __Pyx_PyFrame_SetLineNumber(frame, lineno); tstate->tracing++; - tstate->use_tracing = 0; + __Pyx_SetTracing(tstate, 0); + ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL); - tstate->use_tracing = 1; + + __Pyx_SetTracing(tstate, 1); tstate->tracing--; if (likely(!ret)) { __Pyx_ErrRestoreInState(tstate, type, value, traceback); @@ -199,7 +216,7 @@ PyThreadState *tstate; \ PyGILState_STATE state = PyGILState_Ensure(); \ tstate = __Pyx_PyThreadState_Current; \ - if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \ + if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \ ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \ } \ PyGILState_Release(state); \ @@ -207,7 +224,7 @@ } \ } else { \ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ - if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \ + if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \ int ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \ if (unlikely(ret)) goto_error; \ } \ @@ -217,7 +234,7 @@ #define __Pyx_TraceLine(lineno, nogil, goto_error) \ if (likely(!__Pyx_use_tracing)); else { \ PyThreadState* tstate = __Pyx_PyThreadState_Current; \ - if (unlikely(tstate->use_tracing && tstate->c_tracefunc && $frame_cname->f_trace)) { \ + if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && $frame_cname->f_trace) { \ int ret = __Pyx_call_line_trace_func(tstate, $frame_cname, lineno); \ if (unlikely(ret)) goto_error; \ } \ @@ -263,23 +280,25 @@ (*frame)->f_tstate = tstate; #endif } - __Pyx_PyFrame_SetLineNumber(*frame, firstlineno); + __Pyx_PyFrame_SetLineNumber(*frame, firstlineno); + retval = 1; tstate->tracing++; - tstate->use_tracing = 0; + __Pyx_SetTracing(tstate, 0); __Pyx_ErrFetchInState(tstate, &type, &value, &traceback); + #if CYTHON_TRACE if (tstate->c_tracefunc) retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0; if (retval && tstate->c_profilefunc) #endif retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0; - tstate->use_tracing = (tstate->c_profilefunc || - (CYTHON_TRACE && tstate->c_tracefunc)); + + __Pyx_SetTracing(tstate, (tstate->c_profilefunc || (CYTHON_TRACE && tstate->c_tracefunc))); tstate->tracing--; if (retval) { __Pyx_ErrRestoreInState(tstate, type, value, traceback); - return tstate->use_tracing && retval; + return __Pyx_IsTracing(tstate, 0, 0) && retval; } else { Py_XDECREF(type); Py_XDECREF(value); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/Cython/Utility/StringTools.c new/Cython-0.29.24/Cython/Utility/StringTools.c --- old/Cython-0.29.23/Cython/Utility/StringTools.c 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/Cython/Utility/StringTools.c 2021-07-13 22:36:45.000000000 +0200 @@ -66,8 +66,19 @@ //////////////////// PyUCS4InUnicode //////////////////// +#if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE)) + #if PY_VERSION_HEX < 0x03090000 -#if Py_UNICODE_SIZE == 2 +#define __Pyx_PyUnicode_AS_UNICODE(op) PyUnicode_AS_UNICODE(op) +#define __Pyx_PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(op) +#else +// Avoid calling deprecated C-API functions in Py3.9+ that PEP-623 schedules for removal in Py3.12. +// https://www.python.org/dev/peps/pep-0623/ +#define __Pyx_PyUnicode_AS_UNICODE(op) (((PyASCIIObject *)(op))->wstr) +#define __Pyx_PyUnicode_GET_SIZE(op) ((PyCompactUnicodeObject *)(op))->wstr_length +#endif + +#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2 static int __Pyx_PyUnicodeBufferContainsUCS4_SP(Py_UNICODE* buffer, Py_ssize_t length, Py_UCS4 character) { /* handle surrogate pairs for Py_UNICODE buffers in 16bit Unicode builds */ Py_UNICODE high_val, low_val; @@ -95,7 +106,10 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 character) { #if CYTHON_PEP393_ENABLED const int kind = PyUnicode_KIND(unicode); - if (likely(kind != PyUnicode_WCHAR_KIND)) { + #ifdef PyUnicode_WCHAR_KIND + if (likely(kind != PyUnicode_WCHAR_KIND)) + #endif + { Py_ssize_t i; const void* udata = PyUnicode_DATA(unicode); const Py_ssize_t length = PyUnicode_GET_LENGTH(unicode); @@ -106,20 +120,23 @@ } #elif PY_VERSION_HEX >= 0x03090000 #error Cannot use "UChar in Unicode" in Python 3.9 without PEP-393 unicode strings. +#elif !defined(PyUnicode_AS_UNICODE) + #error Cannot use "UChar in Unicode" in Python < 3.9 without Py_UNICODE support. #endif -#if PY_VERSION_HEX < 0x03090000 -#if Py_UNICODE_SIZE == 2 - if (unlikely(character > 65535)) { + +#if PY_VERSION_HEX < 0x03090000 || (defined(PyUnicode_WCHAR_KIND) && defined(PyUnicode_AS_UNICODE)) +#if !defined(Py_UNICODE_SIZE) || Py_UNICODE_SIZE == 2 + if ((sizeof(Py_UNICODE) == 2) && unlikely(character > 65535)) { return __Pyx_PyUnicodeBufferContainsUCS4_SP( - PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), + __Pyx_PyUnicode_AS_UNICODE(unicode), + __Pyx_PyUnicode_GET_SIZE(unicode), character); } else #endif { return __Pyx_PyUnicodeBufferContainsUCS4_BMP( - PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), + __Pyx_PyUnicode_AS_UNICODE(unicode), + __Pyx_PyUnicode_GET_SIZE(unicode), character); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/PKG-INFO new/Cython-0.29.24/PKG-INFO --- old/Cython-0.29.23/PKG-INFO 2021-04-14 17:25:27.000000000 +0200 +++ new/Cython-0.29.24/PKG-INFO 2021-07-13 22:41:23.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Cython -Version: 0.29.23 +Version: 0.29.24 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. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/docs/conf.py new/Cython-0.29.24/docs/conf.py --- old/Cython-0.29.23/docs/conf.py 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/docs/conf.py 2021-07-13 22:36:58.000000000 +0200 @@ -41,7 +41,7 @@ extensions = [ 'ipython_console_highlighting', 'cython_highlighting', - 'sphinx.ext.pngmath', + 'sphinx.ext.imgmath', 'sphinx.ext.todo', 'sphinx.ext.intersphinx', 'sphinx.ext.autodoc' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/tests/memoryview/memoryview_inline_pxd.srctree new/Cython-0.29.24/tests/memoryview/memoryview_inline_pxd.srctree --- old/Cython-0.29.23/tests/memoryview/memoryview_inline_pxd.srctree 1970-01-01 01:00:00.000000000 +0100 +++ new/Cython-0.29.24/tests/memoryview/memoryview_inline_pxd.srctree 2021-05-24 16:21:54.000000000 +0200 @@ -0,0 +1,35 @@ +# ticket: 1415 + +# Utility code from an inline function in a pxd file was not +# correctly included in a pyx file that cimported it. +# Do not add more to this test - it is intentionally minimal +# to avoid including the utility code through other means + +PYTHON setup.py build_ext --inplace +PYTHON -c "import uses_inline; uses_inline.main()" + +######## setup.py ######## + +from distutils.core import setup +from Cython.Distutils import build_ext +from Cython.Distutils.extension import Extension + +setup( + ext_modules = [ + Extension("uses_inline", ["uses_inline.pyx"]), + ], + cmdclass={'build_ext': build_ext}, +) + +######## has_inline.pxd ######## + +from libc.stdlib cimport malloc +cdef inline double[::1] mview(size_t size): + return <double[:size:1]>malloc(size * sizeof(double)) + +######## uses_inline.pyx ######## + +from has_inline cimport mview +def main(): + return mview(1) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/tests/run/coroutines.py new/Cython-0.29.24/tests/run/coroutines.py --- old/Cython-0.29.23/tests/run/coroutines.py 1970-01-01 01:00:00.000000000 +0100 +++ new/Cython-0.29.24/tests/run/coroutines.py 2021-07-13 22:36:46.000000000 +0200 @@ -0,0 +1,30 @@ +# cython: language_level=3 +# mode: run +# tag: pep492, pure3.5 + + +async def test_coroutine_frame(awaitable): + """ + >>> class Awaitable(object): + ... def __await__(self): + ... return iter([2]) + + >>> coro = test_coroutine_frame(Awaitable()) + >>> import types + >>> isinstance(coro.cr_frame, types.FrameType) or coro.cr_frame + True + >>> coro.cr_frame is coro.cr_frame # assert that it's cached + True + >>> coro.cr_frame.f_code is not None + True + >>> code_obj = coro.cr_frame.f_code + >>> code_obj.co_argcount + 1 + >>> code_obj.co_varnames + ('awaitable', 'b') + + >>> next(coro.__await__()) # avoid "not awaited" warning + 2 + """ + b = await awaitable + return b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/tests/run/cpp_stl_string.pyx new/Cython-0.29.24/tests/run/cpp_stl_string.pyx --- old/Cython-0.29.23/tests/run/cpp_stl_string.pyx 2018-09-22 16:18:56.000000000 +0200 +++ new/Cython-0.29.24/tests/run/cpp_stl_string.pyx 2021-07-13 22:36:58.000000000 +0200 @@ -3,7 +3,7 @@ cimport cython -from libcpp.string cimport string +from libcpp.string cimport string, npos, to_string, stoi, stof b_asdf = b'asdf' b_asdg = b'asdg' @@ -102,6 +102,15 @@ s.push_back(<char>ord('s')) return s.c_str() +def test_pop_back(char *a): + """ + >>> test_pop_back(b'abc') == b'ab' or test_pop_back(b'abc') + True + """ + cdef string s = string(a) + s.pop_back() + return s + def test_insert(char *a, char *b, int i): """ >>> test_insert('AAAA'.encode('ASCII'), 'BBBB'.encode('ASCII'), 2) == 'AABBBBAA'.encode('ASCII') @@ -133,6 +142,17 @@ cdef size_t i = s.find(t) return i +def test_npos(char *a, char *b): + """ + >>> test_npos(b'abc', b'x') + True + >>> test_npos(b'abc', b'a') + False + """ + cdef string s = string(a) + cdef string st = string(b) + return s.find(st) == npos + def test_clear(): """ >>> test_clear() == ''.encode('ASCII') @@ -142,6 +162,18 @@ s.clear() return s.c_str() +def test_erase(char *a, size_t pos=0, size_t count=npos): + """ + >>> test_erase(b'abc') == b'' or test_erase(b'abc') + True + >>> test_erase(b'abc', 1) == b'a' or test_erase(b'abc', 1) + True + >>> test_erase(b'abc', 1, 1) == b'ac' or test_erase(b'abc', 1, 1) + True + """ + cdef string s = string(a) + return s.erase(pos, count) + def test_assign(char *a): """ >>> test_assign(b_asdf) == 'ggg'.encode('ASCII') @@ -346,6 +378,38 @@ return [c for c in s] +def test_to_string(x): + """ + >>> print(test_to_string(5)) + si=5 sl=5 ss=5 sss=5 + >>> print(test_to_string(-5)) + si=-5 sl=-5 ss=5 sss=-5 + """ + si = to_string(<int>x).decode('ascii') + sl = to_string(<long>x).decode('ascii') + ss = to_string(<size_t>abs(x)).decode('ascii') + sss = to_string(<ssize_t>x).decode('ascii') + return f"si={si} sl={sl} ss={ss} sss={sss}" + + +def test_stoi(char *a): + """ + >>> test_stoi(b'5') + 5 + """ + cdef string s = string(a) + return stoi(s) + + +def test_stof(char *a): + """ + >>> test_stof(b'5.5') + 5.5 + """ + cdef string s = string(a) + return stof(s) + + _WARNINGS = """ 21:31: Cannot pass Python object as C++ data structure reference (string &), will pass by copy. """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/tests/run/cython3.pyx new/Cython-0.29.24/tests/run/cython3.pyx --- old/Cython-0.29.23/tests/run/cython3.pyx 2021-02-19 21:31:16.000000000 +0100 +++ new/Cython-0.29.24/tests/run/cython3.pyx 2021-07-13 22:36:58.000000000 +0200 @@ -1,6 +1,6 @@ -# cython: language_level=3, binding=True +# cython: language_level=3, binding=True, annotation_typing=False # mode: run -# tag: generators, python3, exceptions +# tag: generators, python3, exceptions, gh2230, gh2811 print(end='') # test that language_level 3 applies immediately at the module start, for the first token. @@ -619,6 +619,18 @@ return result +def builtin_as_annotation(text: str): + # See https://github.com/cython/cython/issues/2811 + """ + >>> builtin_as_annotation("abc") + a + b + c + """ + for c in text: + print(c) + + async def async_def_annotations(x: 'int') -> 'float': """ >>> ret, arg = sorted(async_def_annotations.__annotations__.items()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/tests/run/generators.pyx new/Cython-0.29.24/tests/run/generators.pyx --- old/Cython-0.29.23/tests/run/generators.pyx 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/tests/run/generators.pyx 2021-07-13 22:36:46.000000000 +0200 @@ -541,3 +541,23 @@ a """ yield from kwargs.keys() + + +def test_generator_frame(a=1): + """ + >>> gen = test_generator_frame() + >>> import types + >>> isinstance(gen.gi_frame, types.FrameType) or gen.gi_frame + True + >>> gen.gi_frame is gen.gi_frame # assert that it's cached + True + >>> gen.gi_frame.f_code is not None + True + >>> code_obj = gen.gi_frame.f_code + >>> code_obj.co_argcount + 1 + >>> code_obj.co_varnames + ('a', 'b') + """ + b = a + 1 + yield b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.23/tests/run/reduce_pickle.pyx new/Cython-0.29.24/tests/run/reduce_pickle.pyx --- old/Cython-0.29.23/tests/run/reduce_pickle.pyx 2020-08-14 10:31:39.000000000 +0200 +++ new/Cython-0.29.24/tests/run/reduce_pickle.pyx 2021-05-24 16:21:37.000000000 +0200 @@ -287,3 +287,20 @@ return "Wrapper(...)" else: return "Wrapper(%r)" % self.ref + + +# Non-regression test for pickling bound and unbound methods of non-extension +# classes +if sys.version_info[:2] >= (3, 5): + # builtin methods not picklable for python <= 3.4 + class MyClass(object): + """ + >>> import pickle + >>> pickle.loads(pickle.dumps(MyClass.my_method)) is MyClass.my_method + True + >>> bound_method = pickle.loads(pickle.dumps(MyClass().my_method)) + >>> bound_method(1) + 1 + """ + def my_method(self, x): + return x