Hello community,
here is the log from the commit of package python-Cython for openSUSE:Factory checked in at 2019-03-04 09:09:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Cython (Old)
and /work/SRC/openSUSE:Factory/.python-Cython.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Cython"
Mon Mar 4 09:09:57 2019 rev:46 rq:680181 version:0.29.6
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Cython/python-Cython-doc.changes 2019-02-08 13:47:48.842790239 +0100
+++ /work/SRC/openSUSE:Factory/.python-Cython.new.28833/python-Cython-doc.changes 2019-03-04 09:10:00.708711574 +0100
@@ -1,0 +2,16 @@
+Thu Feb 28 15:30:08 UTC 2019 - Ondřej Súkup
+
+- update to 0.29.6
+ * Fix a crash when accessing the __kwdefaults__ special attribute of fused functions.
+ * Fix the parsing of buffer format strings that contain numeric sizes, which
+ could lead to incorrect input rejections.
+ * Avoid a C #pragma in old gcc versions that was only added in GCC 4.6.
+ * Auto-encoding of Unicode strings to UTF-8 C/C++ strings failed in Python 3,
+ even though the default encoding there is UTF-8.
+ * Crash when defining a Python subclass of an extension type and repeatedly
+ calling a cpdef method on it.
+ * Compiler crash when prange() loops appear inside of with-statements.
+ * Some C compiler warnings were resolved.
+ * Python conversion of C++ enums failed in 0.29.
+
+-------------------------------------------------------------------
python-Cython.changes: same change
Old:
----
Cython-0.29.4.tar.gz
New:
----
Cython-0.29.6.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-Cython-doc.spec ++++++
--- /var/tmp/diff_new_pack.mlkQrd/_old 2019-03-04 09:10:02.536711268 +0100
+++ /var/tmp/diff_new_pack.mlkQrd/_new 2019-03-04 09:10:02.540711267 +0100
@@ -20,7 +20,7 @@
# Tests currently fail randomly in OBS multiple local rund do not trigger them
%bcond_with test
Name: python-Cython-doc
-Version: 0.29.4
+Version: 0.29.6
Release: 0
Summary: The Cython compiler for writing C extensions for the Python language
License: Apache-2.0
++++++ python-Cython.spec ++++++
--- /var/tmp/diff_new_pack.mlkQrd/_old 2019-03-04 09:10:02.568711263 +0100
+++ /var/tmp/diff_new_pack.mlkQrd/_new 2019-03-04 09:10:02.568711263 +0100
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name: python-Cython
-Version: 0.29.4
+Version: 0.29.6
Release: 0
Summary: The Cython compiler for writing C extensions for the Python language
License: Apache-2.0
++++++ Cython-0.29.4.tar.gz -> Cython-0.29.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/.gitrev new/Cython-0.29.6/.gitrev
--- old/Cython-0.29.4/.gitrev 2019-02-01 16:54:58.000000000 +0100
+++ new/Cython-0.29.6/.gitrev 2019-02-27 13:29:00.000000000 +0100
@@ -1 +1 @@
-272efcf67762e00fd6539ead1ff6e04319266f7e
+060e9090e4617a82ebbf7603f58747aa3519931c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/CHANGES.rst new/Cython-0.29.6/CHANGES.rst
--- old/Cython-0.29.4/CHANGES.rst 2019-02-01 16:54:30.000000000 +0100
+++ new/Cython-0.29.6/CHANGES.rst 2019-02-27 13:23:19.000000000 +0100
@@ -2,6 +2,45 @@
Cython Changelog
================
+0.29.6 (2019-02-27)
+===================
+
+Bugs fixed
+----------
+
+* Fix a crash when accessing the ``__kwdefaults__`` special attribute of
+ fused functions. (Github issue #1470)
+
+* Fix the parsing of buffer format strings that contain numeric sizes, which
+ could lead to incorrect input rejections. (Github issue #2845)
+
+* Avoid a C #pragma in old gcc versions that was only added in GCC 4.6.
+ Patch by Michael Anselmi. (Github issue #2838)
+
+* Auto-encoding of Unicode strings to UTF-8 C/C++ strings failed in Python 3,
+ even though the default encoding there is UTF-8.
+ (Github issue #2819)
+
+
+0.29.5 (2019-02-09)
+===================
+
+Bugs fixed
+----------
+
+* Crash when defining a Python subclass of an extension type and repeatedly calling
+ a cpdef method on it. (Github issue #2823)
+
+* Compiler crash when ``prange()`` loops appear inside of with-statements.
+ (Github issue #2780)
+
+* Some C compiler warnings were resolved.
+ Patches by Christoph Gohlke. (Github issues #2815, #2816, #2817, #2822)
+
+* Python conversion of C++ enums failed in 0.29.
+ Patch by Orivej Desh. (Github issue #2767)
+
+
0.29.4 (2019-02-01)
===================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Compiler/Code.py new/Cython-0.29.6/Cython/Compiler/Code.py
--- old/Cython-0.29.4/Cython/Compiler/Code.py 2019-01-19 10:25:16.000000000 +0100
+++ new/Cython-0.29.6/Cython/Compiler/Code.py 2019-02-08 20:14:39.000000000 +0100
@@ -290,7 +290,7 @@
(r'^%(C)s{5,30}\s*(?P<name>(?:\w|\.)+)\s*%(C)s{5,30}|'
r'^%(C)s+@(?P<tag>\w+)\s*:\s*(?P<value>(?:\w|[.:])+)') %
{'C': comment}).match
- match_type = re.compile('(.+)[.](proto(?:[.]\S+)?|impl|init|cleanup)$').match
+ match_type = re.compile(r'(.+)[.](proto(?:[.]\S+)?|impl|init|cleanup)$').match
with closing(Utils.open_source_file(filename, encoding='UTF-8')) as f:
all_lines = f.readlines()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Compiler/ExprNodes.py new/Cython-0.29.6/Cython/Compiler/ExprNodes.py
--- old/Cython-0.29.4/Cython/Compiler/ExprNodes.py 2018-12-14 15:27:50.000000000 +0100
+++ new/Cython-0.29.6/Cython/Compiler/ExprNodes.py 2019-02-27 13:23:19.000000000 +0100
@@ -9460,7 +9460,8 @@
if self.defaults_kwdict:
code.putln('__Pyx_CyFunction_SetDefaultsKwDict(%s, %s);' % (
self.result(), self.defaults_kwdict.py_result()))
- if def_node.defaults_getter:
+ if def_node.defaults_getter and not self.specialized_cpdefs:
+ # Fused functions do not support dynamic defaults, only their specialisations can have them for now.
code.putln('__Pyx_CyFunction_SetDefaultsGetter(%s, %s);' % (
self.result(), def_node.defaults_getter.entry.pyfunc_cname))
if self.annotations_dict:
@@ -11532,9 +11533,11 @@
def generate_evaluation_code(self, code):
if not self.type.is_pyobject and not self.type.is_complex:
if self.cdivision is None:
- self.cdivision = (code.globalstate.directives['cdivision']
- or not self.type.signed
- or self.type.is_float)
+ self.cdivision = (
+ code.globalstate.directives['cdivision']
+ or self.type.is_float
+ or ((self.type.is_numeric or self.type.is_enum) and not self.type.signed)
+ )
if not self.cdivision:
code.globalstate.use_utility_code(
UtilityCode.load_cached("DivInt", "CMath.c").specialize(self.type))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Compiler/ModuleNode.py new/Cython-0.29.6/Cython/Compiler/ModuleNode.py
--- old/Cython-0.29.4/Cython/Compiler/ModuleNode.py 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/Cython/Compiler/ModuleNode.py 2019-02-27 13:23:19.000000000 +0100
@@ -693,10 +693,13 @@
if c_string_type not in ('bytes', 'bytearray') and not c_string_encoding:
error(self.pos, "a default encoding must be provided if c_string_type is not a byte type")
code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII %s' % int(c_string_encoding == 'ascii'))
+ code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 %s' %
+ int(c_string_encoding.replace('-', '').lower() == 'utf8'))
if c_string_encoding == 'default':
code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 1')
else:
- code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0')
+ code.putln('#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT '
+ '(PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)')
code.putln('#define __PYX_DEFAULT_STRING_ENCODING "%s"' % c_string_encoding)
if c_string_type == 'bytearray':
c_string_func_name = 'ByteArray'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Compiler/Naming.py new/Cython-0.29.6/Cython/Compiler/Naming.py
--- old/Cython-0.29.4/Cython/Compiler/Naming.py 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/Cython/Compiler/Naming.py 2019-02-08 20:14:39.000000000 +0100
@@ -117,6 +117,9 @@
binding_cfunc = pyrex_prefix + "binding_PyCFunctionType"
fused_func_prefix = pyrex_prefix + 'fuse_'
quick_temp_cname = pyrex_prefix + "temp" # temp variable for quick'n'dirty temping
+tp_dict_version_temp = pyrex_prefix + "tp_dict_version"
+obj_dict_version_temp = pyrex_prefix + "obj_dict_version"
+type_dict_guard_temp = pyrex_prefix + "type_dict_guard"
cython_runtime_cname = pyrex_prefix + "cython_runtime"
global_code_object_cache_find = pyrex_prefix + 'find_code_object'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Compiler/Nodes.py new/Cython-0.29.6/Cython/Compiler/Nodes.py
--- old/Cython-0.29.4/Cython/Compiler/Nodes.py 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/Cython/Compiler/Nodes.py 2019-02-27 13:23:19.000000000 +0100
@@ -3443,8 +3443,8 @@
if docstr.is_unicode:
docstr = docstr.as_utf8_string()
- code.putln(
- 'static char %s[] = %s;' % (
+ if not (entry.is_special and entry.name in ('__getbuffer__', '__releasebuffer__')):
+ code.putln('static char %s[] = %s;' % (
entry.doc_cname,
docstr.as_c_string_literal()))
@@ -4354,22 +4354,19 @@
" || (Py_TYPE(%s)->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {" % (
self_arg, self_arg))
- code.putln("#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP")
+ code.putln("#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS")
+ code.globalstate.use_utility_code(
+ UtilityCode.load_cached("PyDictVersioning", "ObjectHandling.c"))
# TODO: remove the object dict version check by 'inlining' the getattr implementation for methods.
# This would allow checking the dict versions around _PyType_Lookup() if it returns a descriptor,
# and would (tada!) make this check a pure type based thing instead of supporting only a single
# instance at a time.
- code.putln("static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0;")
- code.putln("if (likely("
- "Py_TYPE(%s)->tp_dict && "
- "tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(%s)->tp_dict) && "
- "(!Py_TYPE(%s)->tp_dictoffset || "
- "obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(%s)))"
- "));" % (
- self_arg, self_arg, self_arg, self_arg))
- code.putln("else {")
- code.putln("PY_UINT64_T type_dict_guard = (likely(Py_TYPE(%s)->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(%s)->tp_dict) : 0;" % (
- self_arg, self_arg))
+ code.putln("static PY_UINT64_T %s = __PYX_DICT_VERSION_INIT, %s = __PYX_DICT_VERSION_INIT;" % (
+ Naming.tp_dict_version_temp, Naming.obj_dict_version_temp))
+ code.putln("if (unlikely(!__Pyx_object_dict_version_matches(%s, %s, %s))) {" % (
+ self_arg, Naming.tp_dict_version_temp, Naming.obj_dict_version_temp))
+ code.putln("PY_UINT64_T %s = __Pyx_get_tp_dict_version(%s);" % (
+ Naming.type_dict_guard_temp, self_arg))
code.putln("#endif")
func_node_temp = code.funcstate.allocate_temp(py_object_type, manage_ref=True)
@@ -4392,27 +4389,27 @@
# NOTE: it's not 100% sure that we catch the exact versions here that were used for the lookup,
# but it is very unlikely that the versions change during lookup, and the type dict safe guard
# should increase the chance of detecting such a case.
- code.putln("#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP")
- code.putln("tp_dict_version = likely(Py_TYPE(%s)->tp_dict) ?"
- " __PYX_GET_DICT_VERSION(Py_TYPE(%s)->tp_dict) : 0;" % (
- self_arg, self_arg))
- code.putln("obj_dict_version = likely(Py_TYPE(%s)->tp_dictoffset) ?"
- " __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(%s)) : 0;" % (
- self_arg, self_arg))
+ code.putln("#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS")
+ code.putln("%s = __Pyx_get_tp_dict_version(%s);" % (
+ Naming.tp_dict_version_temp, self_arg))
+ code.putln("%s = __Pyx_get_object_dict_version(%s);" % (
+ Naming.obj_dict_version_temp, self_arg))
# Safety check that the type dict didn't change during the lookup. Since CPython looks up the
# attribute (descriptor) first in the type dict and then in the instance dict or through the
# descriptor, the only really far-away lookup when we get here is one in the type dict. So we
# double check the type dict version before and afterwards to guard against later changes of
# the type dict during the lookup process.
- code.putln("if (unlikely(type_dict_guard != tp_dict_version)) {")
- code.putln("tp_dict_version = obj_dict_version = 0;")
+ code.putln("if (unlikely(%s != %s)) {" % (
+ Naming.type_dict_guard_temp, Naming.tp_dict_version_temp))
+ code.putln("%s = %s = __PYX_DICT_VERSION_INIT;" % (
+ Naming.tp_dict_version_temp, Naming.obj_dict_version_temp))
code.putln("}")
code.putln("#endif")
code.put_decref_clear(func_node_temp, PyrexTypes.py_object_type)
code.funcstate.release_temp(func_node_temp)
- code.putln("#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP")
+ code.putln("#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS")
code.putln("}")
code.putln("#endif")
@@ -8439,9 +8436,10 @@
Make any used temporaries private. Before the relevant code block
code.start_collecting_temps() should have been called.
"""
- if self.is_parallel:
- c = self.privatization_insertion_point
+ c = self.privatization_insertion_point
+ self.privatization_insertion_point = None
+ if self.is_parallel:
self.temps = temps = code.funcstate.stop_collecting_temps()
privates, firstprivates = [], []
for temp, type in sorted(temps):
@@ -8532,8 +8530,10 @@
If compiled without OpenMP support (at the C level), then we still have
to acquire the GIL to decref any object temporaries.
"""
+ begin_code = self.begin_of_parallel_block
+ self.begin_of_parallel_block = None
+
if self.error_label_used:
- begin_code = self.begin_of_parallel_block
end_code = code
begin_code.putln("#ifdef _OPENMP")
@@ -8746,6 +8746,8 @@
the for loop.
"""
c = self.begin_of_parallel_control_block_point
+ self.begin_of_parallel_control_block_point = None
+ self.begin_of_parallel_control_block_point_after_decls = None
# Firstly, always prefer errors over returning, continue or break
if self.error_label_used:
@@ -9096,8 +9098,6 @@
self.setup_parallel_control_flow_block(code) # parallel control flow block
- self.control_flow_var_code_point = code.insertion_point()
-
# Note: nsteps is private in an outer scope if present
code.putln("%(nsteps)s = (%(stop)s - %(start)s + %(step)s - %(step)s/abs(%(step)s)) / %(step)s;" % fmt_dict)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Shadow.py new/Cython-0.29.6/Cython/Shadow.py
--- old/Cython-0.29.4/Cython/Shadow.py 2019-02-01 16:54:30.000000000 +0100
+++ new/Cython-0.29.6/Cython/Shadow.py 2019-02-27 13:23:19.000000000 +0100
@@ -1,7 +1,7 @@
# cython.* namespace for pure mode.
from __future__ import absolute_import
-__version__ = "0.29.4"
+__version__ = "0.29.6"
try:
from __builtin__ import basestring
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/Buffer.c new/Cython-0.29.6/Cython/Utility/Buffer.c
--- old/Cython-0.29.4/Cython/Utility/Buffer.c 2018-09-22 16:18:56.000000000 +0200
+++ new/Cython-0.29.6/Cython/Utility/Buffer.c 2019-02-27 13:23:19.000000000 +0100
@@ -200,7 +200,7 @@
__Pyx_BufFmt_Init(&ctx, stack, dtype);
if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
}
- if (unlikely((unsigned)buf->itemsize != dtype->size)) {
+ if (unlikely((size_t)buf->itemsize != dtype->size)) {
PyErr_Format(PyExc_ValueError,
"Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
buf->itemsize, (buf->itemsize > 1) ? "s" : "",
@@ -273,7 +273,7 @@
return -1;
} else {
count = *t++ - '0';
- while (*t >= '0' && *t < '9') {
+ while (*t >= '0' && *t <= '9') {
count *= 10;
count += *t++ - '0';
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/Complex.c new/Cython-0.29.6/Cython/Utility/Complex.c
--- old/Cython-0.29.4/Cython/Utility/Complex.c 2019-01-19 10:25:16.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/Complex.c 2019-02-08 20:14:39.000000000 +0100
@@ -188,13 +188,13 @@
return {{type_name}}_from_parts(a.real / b.real, a.imag / b.imag);
} else {
{{real_type}} r = b.imag / b.real;
- {{real_type}} s = 1.0 / (b.real + b.imag * r);
+ {{real_type}} s = ({{real_type}})(1.0) / (b.real + b.imag * r);
return {{type_name}}_from_parts(
(a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
}
} else {
{{real_type}} r = b.real / b.imag;
- {{real_type}} s = 1.0 / (b.imag + b.real * r);
+ {{real_type}} s = ({{real_type}})(1.0) / (b.imag + b.real * r);
return {{type_name}}_from_parts(
(a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/CythonFunction.c new/Cython-0.29.6/Cython/Utility/CythonFunction.c
--- old/Cython-0.29.4/Cython/Utility/CythonFunction.c 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/CythonFunction.c 2019-02-27 13:23:19.000000000 +0100
@@ -1216,7 +1216,7 @@
//////////////////// ClassMethod.proto ////////////////////
#include "descrobject.h"
-static PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/
+static CYTHON_UNUSED PyObject* __Pyx_Method_ClassMethod(PyObject *method); /*proto*/
//////////////////// ClassMethod ////////////////////
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/Exceptions.c new/Cython-0.29.6/Cython/Utility/Exceptions.c
--- old/Cython-0.29.4/Cython/Utility/Exceptions.c 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/Exceptions.c 2019-02-08 20:14:39.000000000 +0100
@@ -642,6 +642,7 @@
/////////////// CLineInTraceback ///////////////
//@requires: ObjectHandling.c::PyObjectGetAttrStr
+//@requires: ObjectHandling.c::PyDictVersioning
//@requires: PyErrFetchRestore
//@substitute: naming
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/MemoryView_C.c new/Cython-0.29.6/Cython/Utility/MemoryView_C.c
--- old/Cython-0.29.4/Cython/Utility/MemoryView_C.c 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/MemoryView_C.c 2019-02-08 20:14:39.000000000 +0100
@@ -244,7 +244,7 @@
}
if (spec & __Pyx_MEMVIEW_PTR) {
- if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
+ if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
PyErr_Format(PyExc_ValueError,
"Buffer is not indirectly accessible "
"in dimension %d.", dim);
@@ -394,11 +394,7 @@
Py_buffer *buf = &memview->view;
__Pyx_RefNannySetupContext("init_memviewslice", 0);
- if (!buf) {
- PyErr_SetString(PyExc_ValueError,
- "buf is NULL.");
- goto fail;
- } else if (memviewslice->memview || memviewslice->data) {
+ if (memviewslice->memview || memviewslice->data) {
PyErr_SetString(PyExc_ValueError,
"memviewslice is already initialized!");
goto fail;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/ModuleSetupCode.c new/Cython-0.29.6/Cython/Utility/ModuleSetupCode.c
--- old/Cython-0.29.4/Cython/Utility/ModuleSetupCode.c 2019-01-19 10:25:16.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/ModuleSetupCode.c 2019-02-08 20:14:39.000000000 +0100
@@ -428,27 +428,6 @@
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
-#if CYTHON_USE_DICT_VERSIONS
-#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
-#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) \
- (version_var) = __PYX_GET_DICT_VERSION(dict); \
- (cache_var) = (value);
-#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) { \
- static PY_UINT64_T __pyx_dict_version = 0; \
- static PyObject *__pyx_dict_cached_value = NULL; \
- if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) { \
- (VAR) = __pyx_dict_cached_value; \
- } else { \
- (VAR) = __pyx_dict_cached_value = (LOOKUP); \
- __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT); \
- } \
- }
-#else
-#define __PYX_GET_DICT_VERSION(dict) (0)
-#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
-#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
-#endif
-
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
#define PyObject_Malloc(s) PyMem_Malloc(s)
#define PyObject_Free(p) PyMem_Free(p)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/ObjectHandling.c new/Cython-0.29.6/Cython/Utility/ObjectHandling.c
--- old/Cython-0.29.4/Cython/Utility/ObjectHandling.c 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/ObjectHandling.c 2019-02-27 13:23:19.000000000 +0100
@@ -1165,6 +1165,7 @@
/////////////// GetModuleGlobalName.proto ///////////////
+//@requires: PyDictVersioning
//@substitute: naming
#if CYTHON_USE_DICT_VERSIONS
@@ -2397,3 +2398,63 @@
#undef __Pyx_TryMatrixMethod
#endif
+
+
+/////////////// PyDictVersioning.proto ///////////////
+
+#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
+#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
+#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
+#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) \
+ (version_var) = __PYX_GET_DICT_VERSION(dict); \
+ (cache_var) = (value);
+
+#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) { \
+ static PY_UINT64_T __pyx_dict_version = 0; \
+ static PyObject *__pyx_dict_cached_value = NULL; \
+ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) { \
+ (VAR) = __pyx_dict_cached_value; \
+ } else { \
+ (VAR) = __pyx_dict_cached_value = (LOOKUP); \
+ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT); \
+ } \
+}
+
+static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); /*proto*/
+static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); /*proto*/
+static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); /*proto*/
+
+#else
+#define __PYX_GET_DICT_VERSION(dict) (0)
+#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
+#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
+#endif
+
+/////////////// PyDictVersioning ///////////////
+
+#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
+static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
+ PyObject *dict = Py_TYPE(obj)->tp_dict;
+ return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
+}
+
+static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
+ PyObject **dictptr = NULL;
+ Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
+ if (offset) {
+#if CYTHON_COMPILING_IN_CPYTHON
+ dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
+#else
+ dictptr = _PyObject_GetDictPtr(obj);
+#endif
+ }
+ return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
+}
+
+static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
+ PyObject *dict = Py_TYPE(obj)->tp_dict;
+ if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
+ return 0;
+ return obj_dict_version == __Pyx_get_object_dict_version(obj);
+}
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/Optimize.c new/Cython-0.29.6/Cython/Utility/Optimize.c
--- old/Cython-0.29.4/Cython/Utility/Optimize.c 2019-02-01 16:54:30.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/Optimize.c 2019-02-27 13:23:19.000000000 +0100
@@ -123,13 +123,13 @@
#define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) ( \
(likely(PyList_CheckExact(L) && __Pyx_fits_Py_ssize_t(ix, type, is_signed))) ? \
__Pyx__PyList_PopIndex(L, py_ix, ix) : ( \
- (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) : \
+ (unlikely((py_ix) == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) : \
__Pyx__PyObject_PopIndex(L, py_ix)))
#define __Pyx_PyList_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) ( \
__Pyx_fits_Py_ssize_t(ix, type, is_signed) ? \
__Pyx__PyList_PopIndex(L, py_ix, ix) : ( \
- (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) : \
+ (unlikely((py_ix) == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) : \
__Pyx__PyObject_PopIndex(L, py_ix)))
#else
@@ -138,7 +138,7 @@
__Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func)
#define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) ( \
- (unlikely(py_ix == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) : \
+ (unlikely((py_ix) == Py_None)) ? __Pyx__PyObject_PopNewIndex(L, to_py_func(ix)) : \
__Pyx__PyObject_PopIndex(L, py_ix))
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/Overflow.c new/Cython-0.29.6/Cython/Utility/Overflow.c
--- old/Cython-0.29.4/Cython/Utility/Overflow.c 2018-09-22 16:18:56.000000000 +0200
+++ new/Cython-0.29.6/Cython/Utility/Overflow.c 2019-02-27 13:23:19.000000000 +0100
@@ -47,8 +47,12 @@
#define __Pyx_div_const_no_overflow(a, b, overflow) ((a) / (b))
/////////////// Common.init ///////////////
+//@substitute: naming
-__Pyx_check_twos_complement();
+// FIXME: Propagate the error here instead of just printing it.
+if (unlikely(__Pyx_check_twos_complement())) {
+ PyErr_WriteUnraisable($module_cname);
+}
/////////////// BaseCaseUnsigned.proto ///////////////
@@ -226,8 +230,12 @@
/////////////// SizeCheck.init ///////////////
+//@substitute: naming
-__Pyx_check_sane_{{NAME}}();
+// FIXME: Propagate the error here instead of just printing it.
+if (unlikely(__Pyx_check_sane_{{NAME}}())) {
+ PyErr_WriteUnraisable($module_cname);
+}
/////////////// SizeCheck.proto ///////////////
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/Cython/Utility/TypeConversion.c new/Cython-0.29.6/Cython/Utility/TypeConversion.c
--- old/Cython-0.29.4/Cython/Utility/TypeConversion.c 2019-01-19 10:25:16.000000000 +0100
+++ new/Cython-0.29.6/Cython/Utility/TypeConversion.c 2019-02-27 13:23:19.000000000 +0100
@@ -702,6 +702,10 @@
// NOTE: inlining because most arguments are constant, which collapses lots of code below
+// GCC diagnostic pragmas were introduced in GCC 4.6
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+#define GCC_DIAGNOSTIC
+#endif
static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t width, char padding_char, char format_char) {
// simple and conservative C string allocation on the stack: each byte gives at most 3 digits, plus sign
char digits[sizeof({{TYPE}})*3+2];
@@ -711,7 +715,14 @@
Py_ssize_t length, ulength;
int prepend_sign, last_one_off;
{{TYPE}} remaining;
- const {{TYPE}} neg_one = ({{TYPE}}) (({{TYPE}}) 0 - ({{TYPE}}) 1), const_zero = ({{TYPE}}) 0;
+#ifdef GCC_DIAGNOSTIC
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+ const {{TYPE}} neg_one = ({{TYPE}}) -1, const_zero = ({{TYPE}}) 0;
+#ifdef GCC_DIAGNOSTIC
+#pragma GCC diagnostic pop
+#endif
const int is_unsigned = neg_one > const_zero;
if (format_char == 'X') {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/PKG-INFO new/Cython-0.29.6/PKG-INFO
--- old/Cython-0.29.4/PKG-INFO 2019-02-01 16:55:06.000000000 +0100
+++ new/Cython-0.29.6/PKG-INFO 2019-02-27 13:29:02.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: Cython
-Version: 0.29.4
+Version: 0.29.6
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.4/docs/examples/tutorial/clibraries/queue3.pyx new/Cython-0.29.6/docs/examples/tutorial/clibraries/queue3.pyx
--- old/Cython-0.29.4/docs/examples/tutorial/clibraries/queue3.pyx 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/docs/examples/tutorial/clibraries/queue3.pyx 2019-02-27 13:23:19.000000000 +0100
@@ -1,61 +1,61 @@
-# queue.pyx
-
-cimport cqueue
-
-cdef class Queue:
- """A queue class for C integer values.
-
- >>> q = Queue()
- >>> q.append(5)
- >>> q.peek()
- 5
- >>> q.pop()
- 5
- """
- cdef cqueue.Queue* _c_queue
- def __cinit__(self):
- self._c_queue = cqueue.queue_new()
- if self._c_queue is NULL:
- raise MemoryError()
-
- def __dealloc__(self):
- if self._c_queue is not NULL:
- cqueue.queue_free(self._c_queue)
-
- cpdef append(self, int value):
- if not cqueue.queue_push_tail(self._c_queue,
- value):
- raise MemoryError()
-
- # The `cpdef` feature is obviously not available for the original "extend()"
- # method, as the method signature is incompatible with Python argument
- # types (Python does not have pointers). However, we can rename
- # the C-ish "extend()" method to e.g. "extend_ints()", and write
- # a new "extend()" method that provides a suitable Python interface by
- # accepting an arbitrary Python iterable.
- cpdef extend(self, values):
- for value in values:
- self.append(value)
-
- cdef extend_ints(self, int* values, size_t count):
- cdef int value
- for value in values[:count]: # Slicing pointer to limit the iteration boundaries.
- self.append(value)
-
- cpdef int peek(self) except? -1:
- cdef int value = cqueue.queue_peek_head(self._c_queue)
-
- if value == 0:
- # this may mean that the queue is empty,
- # or that it happens to contain a 0 value
- if cqueue.queue_is_empty(self._c_queue):
- raise IndexError("Queue is empty")
- return value
-
- cpdef int pop(self) except? -1:
- if cqueue.queue_is_empty(self._c_queue):
- raise IndexError("Queue is empty")
- return cqueue.queue_pop_head(self._c_queue)
-
- def __bool__(self):
- return not cqueue.queue_is_empty(self._c_queue)
+# queue.pyx
+
+cimport cqueue
+
+cdef class Queue:
+ """A queue class for C integer values.
+
+ >>> q = Queue()
+ >>> q.append(5)
+ >>> q.peek()
+ 5
+ >>> q.pop()
+ 5
+ """
+ cdef cqueue.Queue* _c_queue
+ def __cinit__(self):
+ self._c_queue = cqueue.queue_new()
+ if self._c_queue is NULL:
+ raise MemoryError()
+
+ def __dealloc__(self):
+ if self._c_queue is not NULL:
+ cqueue.queue_free(self._c_queue)
+
+ cpdef append(self, int value):
+ if not cqueue.queue_push_tail(self._c_queue,
+ value):
+ raise MemoryError()
+
+ # The `cpdef` feature is obviously not available for the original "extend()"
+ # method, as the method signature is incompatible with Python argument
+ # types (Python does not have pointers). However, we can rename
+ # the C-ish "extend()" method to e.g. "extend_ints()", and write
+ # a new "extend()" method that provides a suitable Python interface by
+ # accepting an arbitrary Python iterable.
+ cpdef extend(self, values):
+ for value in values:
+ self.append(value)
+
+ cdef extend_ints(self, int* values, size_t count):
+ cdef int value
+ for value in values[:count]: # Slicing pointer to limit the iteration boundaries.
+ self.append(value)
+
+ cpdef int peek(self) except? -1:
+ cdef int value = cqueue.queue_peek_head(self._c_queue)
+
+ if value == 0:
+ # this may mean that the queue is empty,
+ # or that it happens to contain a 0 value
+ if cqueue.queue_is_empty(self._c_queue):
+ raise IndexError("Queue is empty")
+ return value
+
+ cpdef int pop(self) except? -1:
+ if cqueue.queue_is_empty(self._c_queue):
+ raise IndexError("Queue is empty")
+ return cqueue.queue_pop_head(self._c_queue)
+
+ def __bool__(self):
+ return not cqueue.queue_is_empty(self._c_queue)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/docs/examples/userguide/memoryviews/quickstart.pyx new/Cython-0.29.6/docs/examples/userguide/memoryviews/quickstart.pyx
--- old/Cython-0.29.4/docs/examples/userguide/memoryviews/quickstart.pyx 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/docs/examples/userguide/memoryviews/quickstart.pyx 2019-02-27 13:23:19.000000000 +0100
@@ -1,52 +1,52 @@
-from cython.view cimport array as cvarray
-import numpy as np
-
-# Memoryview on a NumPy array
-narr = np.arange(27, dtype=np.dtype("i")).reshape((3, 3, 3))
-cdef int [:, :, :] narr_view = narr
-
-# Memoryview on a C array
-cdef int carr[3][3][3]
-cdef int [:, :, :] carr_view = carr
-
-# Memoryview on a Cython array
-cyarr = cvarray(shape=(3, 3, 3), itemsize=sizeof(int), format="i")
-cdef int [:, :, :] cyarr_view = cyarr
-
-# Show the sum of all the arrays before altering it
-print("NumPy sum of the NumPy array before assignments: %s" % narr.sum())
-
-# We can copy the values from one memoryview into another using a single
-# statement, by either indexing with ... or (NumPy-style) with a colon.
-carr_view[...] = narr_view
-cyarr_view[:] = narr_view
-# NumPy-style syntax for assigning a single value to all elements.
-narr_view[:, :, :] = 3
-
-# Just to distinguish the arrays
-carr_view[0, 0, 0] = 100
-cyarr_view[0, 0, 0] = 1000
-
-# Assigning into the memoryview on the NumPy array alters the latter
-print("NumPy sum of NumPy array after assignments: %s" % narr.sum())
-
-# A function using a memoryview does not usually need the GIL
-cpdef int sum3d(int[:, :, :] arr) nogil:
- cdef size_t i, j, k
- cdef int total = 0
- I = arr.shape[0]
- J = arr.shape[1]
- K = arr.shape[2]
- for i in range(I):
- for j in range(J):
- for k in range(K):
- total += arr[i, j, k]
- return total
-
-# A function accepting a memoryview knows how to use a NumPy array,
-# a C array, a Cython array...
-print("Memoryview sum of NumPy array is %s" % sum3d(narr))
-print("Memoryview sum of C array is %s" % sum3d(carr))
-print("Memoryview sum of Cython array is %s" % sum3d(cyarr))
-# ... and of course, a memoryview.
-print("Memoryview sum of C memoryview is %s" % sum3d(carr_view))
+from cython.view cimport array as cvarray
+import numpy as np
+
+# Memoryview on a NumPy array
+narr = np.arange(27, dtype=np.dtype("i")).reshape((3, 3, 3))
+cdef int [:, :, :] narr_view = narr
+
+# Memoryview on a C array
+cdef int carr[3][3][3]
+cdef int [:, :, :] carr_view = carr
+
+# Memoryview on a Cython array
+cyarr = cvarray(shape=(3, 3, 3), itemsize=sizeof(int), format="i")
+cdef int [:, :, :] cyarr_view = cyarr
+
+# Show the sum of all the arrays before altering it
+print("NumPy sum of the NumPy array before assignments: %s" % narr.sum())
+
+# We can copy the values from one memoryview into another using a single
+# statement, by either indexing with ... or (NumPy-style) with a colon.
+carr_view[...] = narr_view
+cyarr_view[:] = narr_view
+# NumPy-style syntax for assigning a single value to all elements.
+narr_view[:, :, :] = 3
+
+# Just to distinguish the arrays
+carr_view[0, 0, 0] = 100
+cyarr_view[0, 0, 0] = 1000
+
+# Assigning into the memoryview on the NumPy array alters the latter
+print("NumPy sum of NumPy array after assignments: %s" % narr.sum())
+
+# A function using a memoryview does not usually need the GIL
+cpdef int sum3d(int[:, :, :] arr) nogil:
+ cdef size_t i, j, k, I, J, K
+ cdef int total = 0
+ I = arr.shape[0]
+ J = arr.shape[1]
+ K = arr.shape[2]
+ for i in range(I):
+ for j in range(J):
+ for k in range(K):
+ total += arr[i, j, k]
+ return total
+
+# A function accepting a memoryview knows how to use a NumPy array,
+# a C array, a Cython array...
+print("Memoryview sum of NumPy array is %s" % sum3d(narr))
+print("Memoryview sum of C array is %s" % sum3d(carr))
+print("Memoryview sum of Cython array is %s" % sum3d(cyarr))
+# ... and of course, a memoryview.
+print("Memoryview sum of C memoryview is %s" % sum3d(carr_view))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/docs/src/userguide/early_binding_for_speed.rst new/Cython-0.29.6/docs/src/userguide/early_binding_for_speed.rst
--- old/Cython-0.29.4/docs/src/userguide/early_binding_for_speed.rst 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/docs/src/userguide/early_binding_for_speed.rst 2019-02-27 13:23:19.000000000 +0100
@@ -55,7 +55,7 @@
If within Cython code, we have a variable already 'early-bound' (ie, declared
explicitly as type Rectangle, (or cast to type Rectangle), then invoking its
area method will use the efficient C code path and skip the Python overhead.
-But if in Pyrex or regular Python code we have a regular object variable
+But if in Cython or regular Python code we have a regular object variable
storing a Rectangle object, then invoking the area method will require:
* an attribute lookup for the area method
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/tests/buffers/buffmt.pyx new/Cython-0.29.6/tests/buffers/buffmt.pyx
--- old/Cython-0.29.4/tests/buffers/buffmt.pyx 2015-06-22 14:53:11.000000000 +0200
+++ new/Cython-0.29.6/tests/buffers/buffmt.pyx 2019-02-27 13:23:19.000000000 +0100
@@ -37,7 +37,7 @@
cdef class MockBuffer:
cdef Py_ssize_t zero
cdef Py_ssize_t minusone
- cdef object format
+ cdef bytes format
cdef object itemsize
def __init__(self, format, itemsize):
@@ -117,6 +117,9 @@
int c
int d
+ctypedef struct LongString:
+ char[90198] c
+
cdef struct CharIntCFloat:
char a
int b
@@ -180,6 +183,16 @@
cdef object obj = MockBuffer(fmt, sizeof(Char3Int))
cdef object[Char3Int, ndim=1] buf = obj
+
+@testcase
+def long_string(fmt):
+ """
+ >>> long_string("90198s")
+ """
+ cdef object obj = MockBuffer(fmt, sizeof(LongString))
+ cdef object[LongString, ndim=1] buf = obj
+
+
@testcase
def unpacked_struct(fmt):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/tests/run/cpdef_method_override.pyx new/Cython-0.29.6/tests/run/cpdef_method_override.pyx
--- old/Cython-0.29.4/tests/run/cpdef_method_override.pyx 2018-11-24 10:20:06.000000000 +0100
+++ new/Cython-0.29.6/tests/run/cpdef_method_override.pyx 2019-02-27 13:23:19.000000000 +0100
@@ -2,21 +2,82 @@
# tag: cpdef
# ticket: gh-1771
+def _call_method(cls):
+ obj = cls()
+ obj.callmeth()
+ obj = cls()
+ obj.callmeth()
+ obj.callmeth()
+ obj = cls()
+ obj.callmeth()
+ obj.callmeth()
+ obj.callmeth()
+
+
cdef class BaseType:
"""
>>> BaseType().callmeth()
BaseType.meth
+ >>> obj = BaseType()
+ >>> obj.callmeth()
+ BaseType.meth
+ >>> obj.callmeth()
+ BaseType.meth
+ >>> _call_method(BaseType)
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
"""
- def callmeth(self):
+ cpdef callmeth(self):
+ return self.callmeth2()
+ cpdef callmeth2(self):
+ # not overridden by subclasses
return self.meth()
cpdef meth(self):
+ # overridden by subclasses
print("BaseType.meth")
+class NonOverride(BaseType):
+ """
+ >>> NonOverride().callmeth()
+ BaseType.meth
+ >>> obj = NonOverride()
+ >>> obj.callmeth()
+ BaseType.meth
+ >>> obj.callmeth()
+ BaseType.meth
+ >>> _call_method(NonOverride)
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
+ BaseType.meth
+ """
+
+
class PyClass(BaseType):
"""
>>> PyClass().callmeth()
PyClass.meth
+ >>> obj = PyClass()
+ >>> obj.callmeth()
+ PyClass.meth
+ >>> obj.callmeth()
+ PyClass.meth
+ >>> obj.callmeth()
+ PyClass.meth
+ >>> _call_method(PyClass)
+ PyClass.meth
+ PyClass.meth
+ PyClass.meth
+ PyClass.meth
+ PyClass.meth
+ PyClass.meth
"""
def meth(self):
print("PyClass.meth")
@@ -26,8 +87,53 @@
"""
>>> PySlotsClass().callmeth()
PySlotsClass.meth
+ >>> obj = PySlotsClass()
+ >>> obj.callmeth()
+ PySlotsClass.meth
+ >>> obj.callmeth()
+ PySlotsClass.meth
+ >>> obj.callmeth()
+ PySlotsClass.meth
+ >>> _call_method(PySlotsClass)
+ PySlotsClass.meth
+ PySlotsClass.meth
+ PySlotsClass.meth
+ PySlotsClass.meth
+ PySlotsClass.meth
+ PySlotsClass.meth
"""
__slots__ = []
def meth(self):
print("PySlotsClass.meth")
+
+
+class DynamicOverride(BaseType):
+ """
+ >>> DynamicOverride().callmeth()
+ meth1
+ >>> obj = DynamicOverride()
+ >>> obj.callmeth()
+ meth1
+ >>> obj.callmeth()
+ meth2
+ >>> obj.callmeth()
+ BaseType.meth
+ >>> obj.callmeth()
+ BaseType.meth
+ >>> _call_method(DynamicOverride)
+ meth1
+ meth1
+ meth2
+ meth1
+ meth2
+ BaseType.meth
+ """
+ def __init__(self):
+ self.meth = self.meth1
+ def meth1(self):
+ self.meth = self.meth2
+ print("meth1")
+ def meth2(self):
+ del self.meth
+ print("meth2")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/tests/run/cpp_stl_string_utf8_auto_encoding.pyx new/Cython-0.29.6/tests/run/cpp_stl_string_utf8_auto_encoding.pyx
--- old/Cython-0.29.4/tests/run/cpp_stl_string_utf8_auto_encoding.pyx 1970-01-01 01:00:00.000000000 +0100
+++ new/Cython-0.29.6/tests/run/cpp_stl_string_utf8_auto_encoding.pyx 2019-02-27 13:23:19.000000000 +0100
@@ -0,0 +1,150 @@
+# mode: run
+# tag: cpp, werror
+# cython: c_string_encoding=utf-8, c_string_type=unicode
+
+cimport cython
+
+from libcpp.string cimport string
+
+b_asdf = b'asdf'
+s_asdf = 'asdf'
+u_asdf = u'asdf'
+u_s = u's'
+
+
+def test_conversion(py_obj):
+ """
+ >>> test_conversion(b_asdf) == u_asdf or test_conversion(b_asdf)
+ True
+ >>> test_conversion(u_asdf) == u_asdf or test_conversion(u_asdf)
+ True
+ >>> test_conversion(123) # doctest: +ELLIPSIS
+ Traceback (most recent call last):
+ TypeError: expected ..., int found
+ """
+ cdef string s = py_obj
+ assert len(py_obj) == s.length(), '%d != %d' % (len(py_obj), s.length())
+ return s
+
+
+def test_empty(py_obj):
+ """
+ >>> test_empty('')
+ True
+ >>> test_empty('abc')
+ False
+ >>> test_empty(u_asdf[:0])
+ True
+ >>> test_empty(u_asdf)
+ False
+ """
+ cdef string a = py_obj
+ return a.empty()
+
+
+def test_push_back(a):
+ """
+ >>> test_push_back(b_asdf) == u_asdf + u_s
+ True
+ >>> test_push_back(u_asdf) == u_asdf + u_s
+ True
+ """
+ cdef string s = a
+ s.push_back(<char>ord('s'))
+ return s
+
+
+def test_clear(a):
+ """
+ >>> test_clear(u_asdf) == u_s[:0]
+ True
+ >>> test_clear(b_asdf) == u_s[:0]
+ True
+ """
+ cdef string s = a
+ s.clear()
+ return s
+
+
+def test_assign(char *a):
+ """
+ >>> test_assign(b_asdf) == 'ggg'
+ True
+ """
+ cdef string s = string(a)
+ s.assign("ggg")
+ return s.c_str()
+
+
+def test_bytes_cast(a):
+ """
+ >>> b = test_bytes_cast(b'abc')
+ >>> isinstance(b, bytes)
+ True
+ >>> print(b.decode('ascii'))
+ abc
+ >>> b = test_bytes_cast(b'abc\\xe4\\xfc')
+ >>> isinstance(b, bytes)
+ True
+ >>> len(b)
+ 5
+ >>> print(b[:3].decode('ascii'))
+ abc
+ >>> print(ord(b[3:4]))
+ 228
+ >>> print(ord(b[4:5]))
+ 252
+ """
+ cdef string s = a
+ assert s.length() == len(a), "%d != %d" % (s.length(), len(a))
+ return <bytes>s
+
+
+def test_bytearray_cast(a):
+ """
+ >>> b = test_bytearray_cast(b'abc')
+ >>> isinstance(b, bytearray)
+ True
+ >>> print(b.decode('ascii'))
+ abc
+ >>> b = test_bytearray_cast(b'abc\\xe4\\xfc')
+ >>> isinstance(b, bytearray)
+ True
+ >>> len(b)
+ 5
+ >>> print(b[:3].decode('ascii'))
+ abc
+ >>> print(ord(b[3:4]))
+ 228
+ >>> print(ord(b[4:5]))
+ 252
+ """
+ cdef string s = a
+ assert s.length() == len(a), "%d != %d" % (s.length(), len(a))
+ return <bytearray>s
+
+
+def test_unicode_cast(a):
+ """
+ >>> u = test_unicode_cast(b'abc')
+ >>> type(u) is type(u_asdf) or type(u)
+ True
+ >>> print(u)
+ abc
+ """
+ cdef string s = a
+ assert s.length() == len(a), "%d != %d" % (s.length(), len(a))
+ return <unicode>s
+
+
+def test_str_cast(a):
+ """
+ >>> s = test_str_cast(b'abc')
+ >>> type(s) is type(s_asdf) or type(s)
+ True
+ >>> print(s)
+ abc
+ """
+ cdef string s = a
+ assert s.length() == len(a), "%d != %d" % (s.length(), len(a))
+ return <str>s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/tests/run/fused_def.pyx new/Cython-0.29.6/tests/run/fused_def.pyx
--- old/Cython-0.29.4/tests/run/fused_def.pyx 2017-09-16 09:37:01.000000000 +0200
+++ new/Cython-0.29.6/tests/run/fused_def.pyx 2019-02-27 13:23:19.000000000 +0100
@@ -58,12 +58,21 @@
>>> opt_func("spam", f, i)
str object double long
spam 5.60 9 5.60 9
+ >>> opt_func("spam", f, myi=i)
+ str object double long
+ spam 5.60 9 5.60 9
+ >>> opt_func("spam", myf=f, myi=i)
+ str object double long
+ spam 5.60 9 5.60 9
>>> opt_func[str, float, int]("spam", f, i)
str object float int
spam 5.60 9 5.60 9
>>> opt_func[str, cy.double, cy.long]("spam", f, i)
str object double long
spam 5.60 9 5.60 9
+ >>> opt_func[str, cy.double, cy.long]("spam", f, myi=i)
+ str object double long
+ spam 5.60 9 5.60 9
>>> opt_func[str, float, cy.int]("spam", f, i)
str object float int
spam 5.60 9 5.60 9
@@ -129,6 +138,28 @@
opt_func("ham", f, entry4)
+def test_opt_func_introspection():
+ """
+ >>> opt_func.__defaults__
+ (1.2, 7)
+ >>> opt_func.__kwdefaults__
+ >>> opt_func.__annotations__
+ {}
+
+ >>> opt_func[str, float, int].__defaults__
+ (1.2, 7)
+ >>> opt_func[str, float, int].__kwdefaults__
+ >>> opt_func[str, float, int].__annotations__
+ {}
+
+ >>> opt_func[str, cy.double, cy.long].__defaults__
+ (1.2, 7)
+ >>> opt_func[str, cy.double, cy.long].__kwdefaults__
+ >>> opt_func[str, cy.double, cy.long].__annotations__
+ {}
+ """
+
+
def func_with_object(fused_with_object obj, cython.integral myi = 7):
"""
>>> func_with_object(1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.4/tests/run/sequential_parallel.pyx new/Cython-0.29.6/tests/run/sequential_parallel.pyx
--- old/Cython-0.29.4/tests/run/sequential_parallel.pyx 2019-02-01 16:54:30.000000000 +0100
+++ new/Cython-0.29.6/tests/run/sequential_parallel.pyx 2019-02-08 20:14:39.000000000 +0100
@@ -754,3 +754,19 @@
f = &arr[0]
return f[0]
+
+
+def test_prange_in_with(int x, ctx):
+ """
+ >>> from contextlib import contextmanager
+ >>> @contextmanager
+ ... def ctx(l): yield l
+ >>> test_prange_in_with(4, ctx([0]))
+ 6
+ """
+ cdef int i
+ with ctx as l:
+ for i in prange(x, nogil=True):
+ with gil:
+ l[0] += i
+ return l[0]