Skip to content

Commit 64974c3

Browse files
miss-islingtonvstinnermaikschulze
authored
[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 f4c13c8) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Maik Schulze <maik.schulze.cv@googlemail.com>
1 parent d449234 commit 64974c3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎Lib/test/test_capi/test_unicode.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,9 @@ def test_check_interned(self):
18421842

18431843
def fresh_string(text):
18441844
# Create a new string object by decoding a bytes string.
1845-
return text.encode().decode()
1845+
# Add a suffix to make sure that it's not interned, even if
1846+
# the string is interned in the PYC file (Free Threading).
1847+
return (text + ' suffix').encode().decode()
18461848

18471849
s = fresh_string('hello')
18481850
self.assertEqual(check_interned(s), SSTATE_NOT_INTERNED)

0 commit comments

Comments
 (0)