Commit 3ac72f5f authored by Jeroen Demeyer's avatar Jeroen Demeyer Committed by Stefan Behnel

Always enable C line in traceback for tests (GH-3098)

parent ed17da94
...@@ -1114,6 +1114,11 @@ class CythonCompileTestCase(unittest.TestCase): ...@@ -1114,6 +1114,11 @@ class CythonCompileTestCase(unittest.TestCase):
from Cython.Build.Dependencies import update_pythran_extension from Cython.Build.Dependencies import update_pythran_extension
update_pythran_extension(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()): for matcher, fixer in list(EXT_EXTRAS.items()):
if isinstance(matcher, str): if isinstance(matcher, str):
# lazy init # lazy init
......
import traceback # tag: traceback
def foo1(): def foo1():
foo2() foo2()
...@@ -21,6 +21,7 @@ def test_traceback(cline_in_traceback=None): ...@@ -21,6 +21,7 @@ def test_traceback(cline_in_traceback=None):
try: try:
foo1() foo1()
except: except:
import traceback
tb_string = traceback.format_exc() tb_string = traceback.format_exc()
expected = ( expected = (
'tracebacks.pyx', 'tracebacks.pyx',
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# cython: language_level=3 # cython: language_level=3
# mode: run # mode: run
# tag: pep3131 # tag: pep3131, traceback
# Code with unicode identifiers can be compiled with Cython running either Python 2 or 3. # Code with unicode identifiers can be compiled with Cython running either Python 2 or 3.
# However Python access to unicode identifiers is only possible in Python 3. In Python 2 # However Python access to unicode identifiers is only possible in Python 3. In Python 2
......
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