Skip to content

SyntaxError: no symbol table available in pytest_runtest_protocol (type: Function) #6697

Closed

Description

@anki-code
rustpython -V
# Python 3.13.0alpha (heads/master:6ff7b3ed2

git clone https://github.com/xonsh/xonsh
cd xonsh/
rust-pytest
Traceback (most recent call last):
  File "/Users/pc/.local/bin/rust-pytest", line 3, in <module>
    from pytest import console_main
  File "/Users/pc/.local/lib/rustpython3.13t/site-packages/pytest/__init__.py", line 31, in <module>
    from _pytest.legacypath import TempdirFactory
  File "/Users/pc/.local/lib/rustpython3.13t/site-packages/_pytest/legacypath.py", line 30, in <module>
    from _pytest.pytester import HookRecorder
  File "/Users/pc/.local/lib/rustpython3.13t/site-packages/_pytest/pytester.py", line 177
    new_fds = {t[0] for t in lines2} - {t[0] for t in lines1}
              ^
SyntaxError: no symbol table available in pytest_runtest_protocol (type: Function)

Activity

  1. DRMacIver commented on Mar 27, 2026

    @DRMacIver

    Here's a simpler reproducer for this problem BTW:

    def a():
        try:
            return
        finally:
            (0 for a in ())

    Seems to be a problem with any comprehension expression inside a finally block.

  2. fanninpm commented on May 24, 2026

    @fanninpm
    Contributor

    @DRMacIver What is the behavior of CPython with that reproducer, so we have a baseline?

  3. DRMacIver commented on May 24, 2026

    @DRMacIver

    @fanninpm It's just a function definition, so the behaviour for CPython is that it does nothing because no nontrivial code runs.

    (If you called the function it would also do nothing except return None, but the error doesn't require running the function, only loading a file with it in it)

  4. YangSiJun528 commented on Jul 11, 2026

    @YangSiJun528
    Contributor

    take

  5. YangSiJun528 commented on Sep 3, 2026

    @YangSiJun528
    Contributor

    This was fixed by #8507.
    @youknowone, could you please close this issue?

  6. fanninpm commented on Sep 3, 2026

    @fanninpm
    Contributor

    @anki-code @DRMacIver has this been fixed on the latest main commit?

  7. youknowone commented on Oct 6, 2026

    @youknowone
    Member

    Rechecked on current main with a RustPython venv (pip install pytest). pytest 9.1.1 imports, including _pytest.pytester (the originally failing pytest_runtest_protocol body with a generator expression in finally). from pytest import console_main works, and a two-test run reports 2 passed. Closing per #8982.

    — commented by Grok 4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions