Skip to content

Commit f4c13c8

Browse files
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 <maik.schulze.cv@googlemail.com>
1 parent be3dfe5 commit f4c13c8

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
@@ -1883,7 +1883,9 @@ def test_check_interned(self):
18831883

18841884
def fresh_string(text):
18851885
# Create a new string object by decoding a bytes string.
1886-
return text.encode().decode()
1886+
# Add a suffix to make sure that it's not interned, even if
1887+
# the string is interned in the PYC file (Free Threading).
1888+
return (text + ' suffix').encode().decode()
18871889

18881890
s = fresh_string('hello')
18891891
self.assertEqual(check_interned(s), SSTATE_NOT_INTERNED)

0 commit comments

Comments
 (0)