Commit 808fd684 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.29.x'

parents 6e56db7e 6e2c8d0c
......@@ -939,6 +939,23 @@ Other changes
.. _`PEP-479`: https://www.python.org/dev/peps/pep-0479
.. _0.29.28:
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:
0.29.27 (2022-01-28)
......
......@@ -2811,7 +2811,31 @@ 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/%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/%d crashed: %s\n" % (options.shard_num, options.shard_count, exc))
import traceback
traceback.print_exc()
raise
finally:
if enable_faulthandler:
faulthandler.disable()
if common_utility_dir and options.shard_num < 0 and options.cleanup_workdir:
shutil.rmtree(common_utility_dir)
......
"""
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
# tag: numpy
"""
CYTHONIZE -M dep_np.pyx
PYTHON check_np.py
"""
######## dep_np.pyx ########
......@@ -12,14 +14,14 @@ np.import_array()
######## check_np.py ########
import os
import os.path
import re
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()
......@@ -32,19 +34,25 @@ contents = [fname.replace(np_prefix, "np_prefix") for fname in contents]
# filter out the version number from `np_prefix/__init__.cython-30.pxd`.
contents = [re.sub('[.]cython-[0-9]+', '', entry) for entry in contents]
expected = ['cy_prefix/Includes/cpython/object.pxd',
contents = [path.split(os.sep) for path in contents]
contents.sort()
expected = [path.split('/') for path in [
'cy_prefix/Includes/cpython/object.pxd',
'cy_prefix/Includes/cpython/ref.pxd',
'cy_prefix/Includes/cpython/type.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
'''
"""
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', 'pkg/test.pxd']), contents # last is really one level up
assert sorted(contents) == sorted(['test.c:', 'incl.pxi', 'test.pyx', os.path.join('pkg', 'test.pxd')]), contents # last is really one level up
######## pkg/__init__.py ########
......@@ -55,4 +55,3 @@ TEST = 'pkg.sub.test'
######## pkg/sub/incl.pxi ########
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment