Skip to content

Handle missing function names in parsed tracebacks - #94

Open
fly1d wants to merge 1 commit into
ionelmc:masterfrom
fly1d:fix/nameless-traceback-frames
Open

fly1d wants to merge 1 commit into
ionelmc:masterfrom
fly1d:fix/nameless-traceback-frames

Conversation

@fly1d

@fly1d fly1d commented Nov 5, 2026

Copy link
Copy Markdown

Traceback.from_string() accepts file locations without a function name, including the compiler location in standard SyntaxError output. Calling as_traceback() on that parsed traceback currently raises TypeError: replace() argument 'co_name' must be str, not None.

Keep the compiled stub's native name when the parsed name is missing. Supplied names and serialized frame data stay unchanged. The regression uses a real formatted SyntaxError and fails on the original code. The compiler location remains the synthetic frame already accepted by the parser; this does not provide an exact SyntaxError formatting round trip.

Validation on macOS arm64:

  • 65 tests passed on each of CPython 3.11.16, 3.12.13, 3.13.9 and 3.14.7; 3.11–3.13 ran through tox with its uv runner.
  • Source distribution build, twine check and check-manifest passed. The configured Ruff lint/format, Taplo formatting, whitespace, final-newline, mixed-line-ending and debug-statement hooks passed. Separate Taplo syntax-only lint (--no-schema) passed.
  • Documentation HTML built with the existing missing autoapi/index warning. Link checking failed on the unchanged Coveralls URL (403); the added author link passed.

The full tox matrix was not run. tox -e check reached a local 55-second deadline during dependency installation; after installing the declared dependencies with uv, the package checks and remaining hooks were run individually as described above. The combined pre-commit run also reached that deadline during Taplo's online schema lint. Online schema validation remains unverified.

AI assistance: OpenAI Codex helped investigate, implement, test, and review this change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant