Skip to content

Commit

Permalink
pyp: fix generated tracebacks on py313
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed May 27, 2024
1 parent 6c0880a commit fec93e8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,12 @@ def code_for_line(lineno: int) -> str:
if fs.filename == "<pyp>":
if fs.lineno is None:
raise AssertionError("When would this happen?")
fs._line = code_for_line(fs.lineno) # type: ignore[attr-defined]
fs.lineno = "PYP_REDACTED" # type: ignore[assignment]
if sys.version_info >= (3, 13):
fs._lines = code_for_line(fs.lineno) # type: ignore[attr-defined]
fs.colno = None
else:
fs._line = code_for_line(fs.lineno) # type: ignore[attr-defined]
fs.lineno = "PYP_REDACTED" # type: ignore[assignment]

tb_format = tb_except.format()
assert "Traceback (most recent call last)" in next(tb_format)
Expand Down

0 comments on commit fec93e8

Please sign in to comment.