From 6e069db4c2a23bb0a204c7bf75fcfeed855c0299 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 5 Nov 2026 11:21:50 +0100 Subject: [PATCH] gh-161354: Fix test_ast.test_nodes_have_inline_values() Run the test in a subprocess to make it more deterministic. --- Lib/test/test_ast/test_ast.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/test/test_ast/test_ast.py b/Lib/test/test_ast/test_ast.py index 095bc5832f6aca..45e953dfe0a713 100644 --- a/Lib/test/test_ast/test_ast.py +++ b/Lib/test/test_ast/test_ast.py @@ -25,6 +25,7 @@ _testinternalcapi = None from test import support +from test.support import isolation from test.support import os_helper from test.support import (skip_emscripten_stack_overflow, skip_wasi_stack_overflow, @@ -104,6 +105,10 @@ def test_AST_objects(self): ast.AST(2) @unittest.skipIf(_testinternalcapi is None, "requires _testinternalcapi") + # gh-161354: Run the test in a subprocess to make it more deterministic. + # Inline values depend on Constant_type.ht_cached_keys which changes when + # ast.Constant instances are created, so they depend on other run tests. + @isolation.runInSubprocess() def test_nodes_have_inline_values(self): tree = ast.parse("x = f(y, z=1)") for node in ast.walk(tree):