You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Redundant File ..., line N block in SyntaxError output #14994
Only strip the redundant File "...", line N header during collection (importtestmodule), and only when the file:line:col crash line is appended (reprcrash.column is not None).
Keep the source and caret lines (def broken(: / ^) — they are the only place the user's code appears in a collection error.
Leave runtime --tb=long/--tb=short unchanged: there the location line is still the test frame, so the File line is not redundant.
Leave the fallback path (no column) and ExceptionInfo.exconly / --tb=native unchanged.
Target collection output:
E def broken(:
E ^
E SyntaxError: invalid syntax
package/lib.py:1:12: SyntaxError: invalid syntax
Activity
avenet commentedon Oct 16, 2026
Proposed scope for this follow-up (after #14899):
File "...", line Nheader during collection (importtestmodule), and only when thefile:line:colcrash line is appended (reprcrash.column is not None).def broken(:/^) — they are the only place the user's code appears in a collection error.--tb=long/--tb=shortunchanged: there the location line is still the test frame, so theFileline is not redundant.ExceptionInfo.exconly/--tb=nativeunchanged.Target collection output:
Does this scope look right before a PR?