Skip to content

Commit

Permalink
debug: keep COVERAGE_DIS=1 working well on 3.13
Browse files Browse the repository at this point in the history
It's helpful to see byte offsets.  I'm learning that dis is not considered
something that needs backward compatibility...
  • Loading branch information
nedbat committed May 5, 2024
1 parent 92c2490 commit c69e5db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/helpers.py
Expand Up @@ -114,8 +114,11 @@ def make_file(
print(f"# {os.path.abspath(filename)}", file=fdis)
cur_test = os.getenv("PYTEST_CURRENT_TEST", "unknown")
print(f"# PYTEST_CURRENT_TEST = {cur_test}", file=fdis)
kwargs = {}
if env.PYVERSION >= (3, 13):
kwargs["show_offsets"] = True
try:
dis.dis(text, file=fdis)
dis.dis(text, file=fdis, **kwargs)
except Exception as exc:
# Some tests make .py files that aren't Python, so dis will
# fail, which is expected.
Expand Down

0 comments on commit c69e5db

Please sign in to comment.