Skip to content

Commit 8e5709e

Browse files
authored
Align native threading and libraries with Python 3.15 (#9148)
Preserve lock ownership and elapsed timeouts during interruptible waits; reject RLock constructor arguments and use replacement encoding for thread names. Generate associated libraries and tests from CPython d220409a13b77de7a6c30abe16ea90db01528edc using update_lib, retaining five existing markers and retiring one proven removed test owner. AI-assisted source preparation and review. Runtime validation remains pending. Assisted-by: OpenAI Codex:model version unavailable
1 parent a2c11aa commit 8e5709e

6 files changed

Lines changed: 599 additions & 42 deletions

File tree

‎Lib/_threading_local.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def thread_deleted(_, idt=idt):
5757
# as soon as the OS-level thread ends instead.
5858
local = wrlocal()
5959
if local is not None:
60-
dct = local.dicts.pop(idt)
60+
local.dicts.pop(idt)
6161
wrlocal = ref(self, local_deleted)
6262
wrthread = ref(thread, thread_deleted)
6363
thread.__dict__[key] = wrlocal

‎Lib/test/lock_tests.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ def test_constructor(self):
124124
lock = self.locktype()
125125
del lock
126126

127+
def test_constructor_noargs(self):
128+
self.assertRaises(TypeError, self.locktype, 1)
129+
self.assertRaises(TypeError, self.locktype, x=1)
130+
self.assertRaises(TypeError, self.locktype, 1, x=2)
131+
127132
def test_repr(self):
128133
lock = self.locktype()
129134
self.assertRegex(repr(lock), "<unlocked .* object (.*)?at .*>")

‎Lib/test/test_thread_local_bytecode.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import unittest
44

55
from test import support
6-
from test.support import cpython_only, import_helper, requires_specialization_ft
6+
from test.support import cpython_only, import_helper, requires_specialization
77
from test.support.script_helper import assert_python_ok
88
from test.support.threading_helper import requires_working_threading
99

@@ -15,7 +15,7 @@
1515
@requires_working_threading()
1616
@unittest.skipUnless(support.Py_GIL_DISABLED, "only in free-threaded builds")
1717
class TLBCTests(unittest.TestCase):
18-
@requires_specialization_ft
18+
@requires_specialization
1919
def test_new_threads_start_with_unspecialized_code(self):
2020
code = textwrap.dedent("""
2121
import dis
@@ -46,7 +46,7 @@ def f(a, b, q=None):
4646
""")
4747
assert_python_ok("-X", "tlbc=1", "-c", code)
4848

49-
@requires_specialization_ft
49+
@requires_specialization
5050
def test_threads_specialize_independently(self):
5151
code = textwrap.dedent("""
5252
import dis
@@ -108,7 +108,6 @@ def f(a, b, q=None):
108108
""")
109109
assert_python_ok("-X", "tlbc=1", "-c", code)
110110

111-
@support.skip_if_sanitizer("gh-129752: data race on adaptive counter", thread=True)
112111
def test_no_copies_if_tlbc_disabled(self):
113112
code = textwrap.dedent("""
114113
import queue

0 commit comments

Comments
 (0)