python – Debugging Cythonized code using Visual Studio 2022


I am trying to debug a Cythonized Python project using Visual Studio 2022 with the following setup.py file:

extensions = [
    Extension("ticker", ["ticker.py"],
          extra_compile_args=["-Ox", "-Zi"],
          extra_link_args=["-debug:full"]),
    Extension("ticker_dep", ["ticker_dep.py"],
          extra_compile_args=["-Ox", "-Zi"],
          extra_link_args=["-debug:full"])
]

setup(
    ext_modules=cythonize(extensions, emit_linenums=True)
)

using the build command:

python setup.py build_ext –build-lib ./build

when stepping in the debugged code, I get the following error:

Message=ForwardRef._evaluate() missing 1 required keyword-only argument: ‘recursive_guard’
Source=C:\RTFilingsNLPC\businesslib\build\fragment_search.py
StackTrace:
File “C:\RTFilingsNLPC\businesslib\build\fragment_search.py”, line 7, in (Current frame)
from spacy.tokens import Token
File “C:\RTFilingsNLPC\businesslib\build\sc_13d.py”, line 6, in
from fragment_search import FragmentSearch
File “C:\RTFilingsNLPC\businesslib\build\rtf_bootstrap.py”, line 10, in
from sc_13d import Sc13dParser
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: ‘recursive_guard’

Running this code as pure python works correctly.

Can somebody please help with this?

Thanks,
Ronny

Leave a Reply

Your email address will not be published. Required fields are marked *