https://github.com/python/cpython/commit/f4c13c80cdb9c350cf474ea5b9cf85245cbf89c7
commit: f4c13c80cdb9c350cf474ea5b9cf85245cbf89c7
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-16T16:03:36Z
summary:

gh-162092: Fix test_check_interned() of test_capi (#162099)

Fix fresh_string() for Free Threaded build to make sure that the
string is not  interned.

Co-authored-by: Maik Schulze <[email protected]>

files:
M Lib/test/test_capi/test_unicode.py

diff --git a/Lib/test/test_capi/test_unicode.py 
b/Lib/test/test_capi/test_unicode.py
index 84303bc379cf13..fe4e8e3b5046e6 100644
--- a/Lib/test/test_capi/test_unicode.py
+++ b/Lib/test/test_capi/test_unicode.py
@@ -1883,7 +1883,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)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to