From 5ba24b45a3e4d5b49c0fb9590c3e36d12c54d174 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 16 Feb 2022 12:53:32 +0100 Subject: Prepare release of 0.29.28. --- CHANGES.rst | 15 +++++++++++++++ Cython/Shadow.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 77d8d6262..23ab2bfe3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,21 @@ Cython Changelog ================ +0.29.28 (2022-02-16) +==================== + +Bugs fixed +---------- + +* Due to backwards incompatible changes in CPython 3.11a4, the feature flags + ``CYTHON_FAST_THREAD_STATE`` and ``CYTHON_USE_EXC_INFO_STACK`` are now disabled + in Python 3.11 and later. They are enabled again in Cython 3.0. + Patch by David Woods. (Github issue #4610) + +* A C compiler warning in older PyPy versions was resolved. + Patch by Matti Picus. (Github issue #4236) + + 0.29.27 (2022-01-28) ==================== diff --git a/Cython/Shadow.py b/Cython/Shadow.py index e7b9e4f61..fb662dc05 100644 --- a/Cython/Shadow.py +++ b/Cython/Shadow.py @@ -1,7 +1,7 @@ # cython.* namespace for pure mode. from __future__ import absolute_import -__version__ = "0.29.27" +__version__ = "0.29.28" try: from __builtin__ import basestring -- cgit v1.2.1 From f61e759dcc2fb5ab3e9398a43468d44b7a9a6818 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 16 Feb 2022 13:19:53 +0100 Subject: Fix depfile tests on Windows. --- tests/build/depfile.srctree | 6 +++--- tests/build/depfile_numpy.srctree | 25 ++++++++++++++++--------- tests/build/depfile_package.srctree | 13 ++++++------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/tests/build/depfile.srctree b/tests/build/depfile.srctree index 0c2194f75..1a9df6b00 100644 --- a/tests/build/depfile.srctree +++ b/tests/build/depfile.srctree @@ -1,5 +1,7 @@ +""" PYTHON -m Cython.Build.Cythonize -M foo.pyx PYTHON check.py +""" ######## foo.pyx ######## @@ -25,9 +27,7 @@ cdef inline void empty(): ######## check.py ######## -import os - with open("foo.c.dep", "r") as f: - contents = f.read().replace("\n", " ").replace("\\", "") + contents = f.read().replace("\\\n", " ").replace("\n", " ") assert sorted(contents.split()) == ['bar.pxd', 'baz.pxi', 'foo.c:', 'foo.pyx'], contents diff --git a/tests/build/depfile_numpy.srctree b/tests/build/depfile_numpy.srctree index 4a2461c64..3e2164ba9 100644 --- a/tests/build/depfile_numpy.srctree +++ b/tests/build/depfile_numpy.srctree @@ -1,7 +1,9 @@ # tag: numpy +""" PYTHON -m Cython.Build.Cythonize -M dep_np.pyx PYTHON check_np.py +""" ######## dep_np.pyx ######## @@ -12,14 +14,13 @@ np.import_array() ######## check_np.py ######## -import os -import re +import os.path import numpy as np import Cython with open("dep_np.c.dep", "r") as f: - contents = f.read().replace("\n", " ").replace("\\", "") + contents = f.read().replace('\\\n', ' ').replace('\n', ' ') contents = contents.split() @@ -29,7 +30,11 @@ contents = [fname.replace(cy_prefix, "cy_prefix") for fname in contents] np_prefix, _ = os.path.split(np.__file__) contents = [fname.replace(np_prefix, "np_prefix") for fname in contents] -expected = ['cy_prefix/Includes/cpython/buffer.pxd', +contents = [path.split(os.sep) for path in contents] +contents.sort() + +expected = [path.split('/') for path in [ + 'cy_prefix/Includes/cpython/buffer.pxd', 'cy_prefix/Includes/cpython/mem.pxd', 'cy_prefix/Includes/cpython/object.pxd', 'cy_prefix/Includes/cpython/ref.pxd', @@ -37,13 +42,15 @@ expected = ['cy_prefix/Includes/cpython/buffer.pxd', 'cy_prefix/Includes/libc/stdio.pxd', 'cy_prefix/Includes/libc/string.pxd', 'dep_np.c:', - 'dep_np.pyx',] + 'dep_np.pyx', +]] # Also account for legacy numpy versions, which do not ship # `__init__.pxd` hence the fallback is used: -if 'cy_prefix/Includes/numpy/__init__.pxd' in contents: - expected.append('cy_prefix/Includes/numpy/__init__.pxd') +if ['cy_prefix', 'Includes', 'numpy', '__init__.pxd'] in contents: + expected.append(['cy_prefix', 'Includes', 'numpy', '__init__.pxd']) else: - expected.append('np_prefix/__init__.pxd') + expected.append(['np_prefix', '__init__.pxd']) -assert sorted(contents) == sorted(expected), sorted(contents) +expected.sort() +assert contents == expected, contents diff --git a/tests/build/depfile_package.srctree b/tests/build/depfile_package.srctree index 54dcad9f1..8e0916ca5 100644 --- a/tests/build/depfile_package.srctree +++ b/tests/build/depfile_package.srctree @@ -1,16 +1,16 @@ -''' +""" PYTHON -m Cython.Build.Cythonize -i pkg --depfile PYTHON package_test.py -''' +""" ######## package_test.py ######## -import os +import os.path with open("pkg/test.c.dep", "r") as f: - contents = f.read().replace("\n", " ").replace("\\", "") + contents = f.read().replace("\\\n", " ").replace("\\\n", " ") -assert sorted(contents.split()) == sorted(['test.c:', 'sub/incl.pxi', 'test.pxd', 'test.pyx']), contents +assert sorted(contents.split()) == sorted(['test.c:', os.path.join('sub', 'incl.pxi'), 'test.pxd', 'test.pyx']), contents with open("pkg/sub/test.c.dep", "r") as f: @@ -18,7 +18,7 @@ with open("pkg/sub/test.c.dep", "r") as f: contents = [os.path.relpath(entry, '.') if os.path.isabs(entry) else entry for entry in contents.split()] -assert sorted(contents) == sorted(['test.c:', 'incl.pxi', 'test.pyx', '../test.pxd']), contents +assert sorted(contents) == sorted(['test.c:', 'incl.pxi', 'test.pyx', os.path.join('..', 'test.pxd')]), contents ######## pkg/__init__.py ######## @@ -55,4 +55,3 @@ TEST = 'pkg.sub.test' ######## pkg/sub/incl.pxi ######## pass - -- cgit v1.2.1 From 2cf17f195c746ae0e9fd13840bec8d4a2f1afb23 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 16 Feb 2022 19:55:23 +0100 Subject: Enable faulthandler around the test runs to get a notice on shard crashes. --- runtests.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/runtests.py b/runtests.py index 591746a87..5f707b9b5 100755 --- a/runtests.py +++ b/runtests.py @@ -2501,7 +2501,33 @@ def runtests(options, cmd_args, coverage=None): except AttributeError: pass # not available on PyPy - result = test_runner.run(test_suite) + enable_faulthandler = False + try: + import faulthandler + except ImportError: + pass + else: + enable_faulthandler = not faulthandler.is_enabled() + if enable_faulthandler: + faulthandler.enable() + + # Run the collected tests. + try: + if options.shard_num > -1: + sys.stderr.write("Tests in shard %d starting" % options.shard_num) + result = test_runner.run(test_suite) + except Exception as exc: + # Make sure we print exceptions also from shards. + if options.shard_num > -1: + sys.stderr.write("Tests in shard %d crashed: %s" % (options.shard_num, exc)) + import traceback + traceback.print_exc() + finally: + if enable_faulthandler: + faulthandler.disable() + if options.shard_num > -1: + sys.stderr.write("Tests in shard %d terminated (%s)" % ( + options.shard_num, sys.exc_info()[1] or "no crash")) if common_utility_dir and options.shard_num < 0 and options.cleanup_workdir: shutil.rmtree(common_utility_dir) -- cgit v1.2.1 From 9494ec3b00dd07932571742c5aceb991a6fd6050 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 16 Feb 2022 21:43:06 +0100 Subject: runtests: Keep failing on test runner exceptions, because we can't continue without a test result. --- runtests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/runtests.py b/runtests.py index 5f707b9b5..8f83e2229 100755 --- a/runtests.py +++ b/runtests.py @@ -2522,6 +2522,7 @@ def runtests(options, cmd_args, coverage=None): sys.stderr.write("Tests in shard %d crashed: %s" % (options.shard_num, exc)) import traceback traceback.print_exc() + raise finally: if enable_faulthandler: faulthandler.disable() -- cgit v1.2.1 From 6e2c8d0cddfc626e74728ece87b3974c4ffd5536 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 16 Feb 2022 21:52:40 +0100 Subject: runtests: Improve exception output. --- runtests.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/runtests.py b/runtests.py index 8f83e2229..55f244ab0 100755 --- a/runtests.py +++ b/runtests.py @@ -2514,21 +2514,18 @@ def runtests(options, cmd_args, coverage=None): # Run the collected tests. try: if options.shard_num > -1: - sys.stderr.write("Tests in shard %d starting" % options.shard_num) + sys.stderr.write("Tests in shard %d/%d starting\n" % (options.shard_num, options.shard_count)) result = test_runner.run(test_suite) except Exception as exc: # Make sure we print exceptions also from shards. if options.shard_num > -1: - sys.stderr.write("Tests in shard %d crashed: %s" % (options.shard_num, exc)) + sys.stderr.write("Tests in shard %d/%d crashed: %s\n" % (options.shard_num, options.shard_count, exc)) import traceback traceback.print_exc() raise finally: if enable_faulthandler: faulthandler.disable() - if options.shard_num > -1: - sys.stderr.write("Tests in shard %d terminated (%s)" % ( - options.shard_num, sys.exc_info()[1] or "no crash")) if common_utility_dir and options.shard_num < 0 and options.cleanup_workdir: shutil.rmtree(common_utility_dir) -- cgit v1.2.1