From c509f83665fae84cd088de83ed59bff374d75ae0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 16 Nov 2026 17:03:36 +0100 Subject: [PATCH] gh-162092: Fix test_check_interned() of test_capi (GH-162099) Fix fresh_string() for Free Threaded build to make sure that the string is not interned. (cherry picked from commit f4c13c80cdb9c350cf474ea5b9cf85245cbf89c7) Co-authored-by: Victor Stinner Co-authored-by: Maik Schulze --- Lib/test/test_capi/test_unicode.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_capi/test_unicode.py b/Lib/test/test_capi/test_unicode.py index 50fdb7647ed3771..cf181c5b201eef8 100644 --- a/Lib/test/test_capi/test_unicode.py +++ b/Lib/test/test_capi/test_unicode.py @@ -1842,7 +1842,9 @@ def test_check_interned(self): def fresh_string(text): # Create a new string object by decoding a bytes string. - return text.encode().decode() + # Add a suffix to make sure that it's not interned, even if + # the string is interned in the PYC file (Free Threading). + return (text + ' suffix').encode().decode() s = fresh_string('hello') self.assertEqual(check_interned(s), SSTATE_NOT_INTERNED)