https://github.com/python/cpython/commit/64974c33a9ff748b2dd92abb2491523b335572e7
commit: 64974c33a9ff748b2dd92abb2491523b335572e7
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-16T17:56:05+01:00
summary:

[3.15] gh-162092: Fix test_check_interned() of test_capi (GH-162099) (#162118)

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 <[email protected]>
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 50fdb7647ed377..cf181c5b201eef 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)

_______________________________________________
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