summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_memoryio.py
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-05-07 00:12:39 (GMT)
committerGitHub <noreply@github.com>2024-05-07 00:12:39 (GMT)
commit723d4d2fe8e77b398f0ccffcfa541149caaac6a1 (patch)
tree8d213981ac3bc060c5046acdc256015d2c821476 /Lib/test/test_memoryio.py
parent8d8275b0cf43f0e20c72a9641cbddc5044cdae04 (diff)
downloadcpython-723d4d2fe8e77b398f0ccffcfa541149caaac6a1.zip
cpython-723d4d2fe8e77b398f0ccffcfa541149caaac6a1.tar.gz
cpython-723d4d2fe8e77b398f0ccffcfa541149caaac6a1.tar.bz2
gh-118527: Intern code consts in free-threaded build (#118667)
We already intern and immortalize most string constants. In the free-threaded build, other constants can be a source of reference count contention because they are shared by all threads running the same code objects.
Diffstat (limited to 'Lib/test/test_memoryio.py')
-rw-r--r--Lib/test/test_memoryio.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index 8192502..95629ed 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -801,7 +801,7 @@ class CBytesIOTest(PyBytesIOTest):
def _test_cow_mutation(self, mutation):
# Common code for all BytesIO copy-on-write mutation tests.
- imm = b' ' * 1024
+ imm = (' ' * 1024).encode("ascii")
old_rc = sys.getrefcount(imm)
memio = self.ioclass(imm)
self.assertEqual(sys.getrefcount(imm), old_rc + 1)