This is similar issue to #16, the test_sys_modules test fails with Python 3.13.0b3 even if I apply the patch from PR #17 (however, I confirm it resolves the issue with Python 3.13.0b1).
================================================= test session starts =================================================
platform linux -- Python 3.13.0b3, pytest-8.2.2, pluggy-1.5.0 -- /var/tmp/portage/dev-python/pure-eval-0.2.2/work/pure_eval-0.2.2-python3_13/install/usr/bin/python3.13
cachedir: .pytest_cache
rootdir: /var/tmp/portage/dev-python/pure-eval-0.2.2/work/pure_eval-0.2.2
configfile: pyproject.toml
collecting ... collected 47 items
[snip]
tests/test_utils.py::test_sys_modules FAILED [41/47]
[snip]
====================================================== FAILURES =======================================================
__________________________________________________ test_sys_modules ___________________________________________________
def test_sys_modules():
modules = sys_modules_sources()
if not os.environ.get('PURE_EVAL_SLOW_TESTS'):
modules = islice(modules, 0, 3)
for filename, source, tree in modules:
print(filename)
if not filename.endswith("ast.py"):
> check_copy_ast_without_context(tree)
[snip]
tests/test_utils.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tree = <ast.Module object at 0x7f3462e4f4d0>
def check_copy_ast_without_context(tree):
tree2 = copy_ast_without_context(tree)
dump1 = ast.dump(tree)
dump2 = ast.dump(tree2)
normalised_dump1 = re.sub(
# Two possible matches:
# - first one like ", ctx=…" where ", " should be removed
# - second one like "(ctx=…" where "(" should be kept
(
r"("
r", ctx=(Load|Store|Del)\(\)"
r"|"
r"(?<=\()ctx=(Load|Store|Del)\(\)"
r")"
),
"",
dump1
)
> assert normalised_dump1 == dump2
E assert 'Module(body=[Expr(value=Constant(value=\'Core implementation of import.\\n\\nThis module is NOT meant to be directly imported! It has been designed such\\nthat it can be bootstrapped into Python as the implementation[snip]
E
E - Module(body=[Expr(value=Constant(value='Core implementation of import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import.[snip]
E + Module(body=[Expr(value=Constant(value='Core implementation of import.\n\nThis module is NOT meant to be directly imported! It has been designed such\nthat it can be bootstrapped into Python as the implementation of import.[snip]
[snip]
======================================= 1 failed, 46 passed, 1 warning in 9.88s =======================================
This is similar issue to #16, the
test_sys_modules
test fails with Python 3.13.0b3 even if I apply the patch from PR #17 (however, I confirm it resolves the issue with Python 3.13.0b1).