summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Demeyer <jeroen.k.demeyer@gmail.com>2019-08-26 22:58:40 +0200
committerStefan Behnel <stefan_ml@behnel.de>2020-04-26 13:48:48 +0200
commitb648b65ac39291aa546b58e44c8576869c351b66 (patch)
tree24a422557b6375d788d15bc97e58b8e991c10f95
parent47f39d56abcff3bccbdc937c1cf718de4bd2364e (diff)
downloadcython-b648b65ac39291aa546b58e44c8576869c351b66.tar.gz
Always enable C line in traceback for tests (GH-3098)0.29.17
-rwxr-xr-xruntests.py5
-rw-r--r--tests/run/tracebacks.pyx3
2 files changed, 7 insertions, 1 deletions
diff --git a/runtests.py b/runtests.py
index 40843d7e7..3b4d8adfb 100755
--- a/runtests.py
+++ b/runtests.py
@@ -1096,6 +1096,11 @@ class CythonCompileTestCase(unittest.TestCase):
from Cython.Build.Dependencies import update_pythran_extension
update_pythran_extension(extension)
+ # Compile with -DCYTHON_CLINE_IN_TRACEBACK=1 unless we have
+ # the "traceback" tag
+ if 'traceback' not in self.tags['tag']:
+ extension.define_macros.append(("CYTHON_CLINE_IN_TRACEBACK", 1))
+
for matcher, fixer in list(EXT_EXTRAS.items()):
if isinstance(matcher, str):
# lazy init
diff --git a/tests/run/tracebacks.pyx b/tests/run/tracebacks.pyx
index b33e852dc..17b93b448 100644
--- a/tests/run/tracebacks.pyx
+++ b/tests/run/tracebacks.pyx
@@ -1,4 +1,4 @@
-import traceback
+# tag: traceback
def foo1():
foo2()
@@ -21,6 +21,7 @@ def test_traceback(cline_in_traceback=None):
try:
foo1()
except:
+ import traceback
tb_string = traceback.format_exc()
expected = (
'tracebacks.pyx',