cython: traceback.print_exc() shows stacktrace of cython layer, but traceback.print_stack() does not

print_exc()

hello.pyx

import traceback

try:
    raise
except:
    traceback.print_exc()

=>

Traceback (most recent call last):
  File "hello.pyx", line 4, in hello (hello.c:1050)
    raise

print_stack()

hello.pyx

import traceback

traceback.print_stack()

=>

  File "/home/sonots/.pyenv/versions/3.6.1/lib/python3.6/traceback.py", line 186, in print_stack
    print_list(extract_stack(f, limit=limit), file=file)

This does not show File "hello.pyx", line 4, in hello (hello.c:1050)

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

Trackebacks are added as the exception propagates upwards; for debugging you could simply raise an exception to see where you are.