Skip to content

Commit a637df9

Browse files
miss-islingtonvstinnermaikschulze
authored
[3.14] gh-162092: Fix test_check_interned() of test_capi (GH-162099) (#162119)
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 4faf413 commit a637df9

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

18301830
def fresh_string(text):
18311831
# Create a new string object by decoding a bytes string.
1832-
return text.encode().decode()
1832+
# Add a suffix to make sure that it's not interned, even if
1833+
# the string is interned in the PYC file (Free Threading).
1834+
return (text + ' suffix').encode().decode()
18331835

18341836
s = fresh_string('hello')
18351837
self.assertEqual(check_interned(s), SSTATE_NOT_INTERNED)

0 commit comments

Comments
 (0)