Skip to content

Commit ee52c8e

Browse files
gh-83274: Skip the wrong-thread warning check on the free-threaded build
On the free-threaded build the interpreter may be deallocated in its own thread (deferred reference counting), so the RuntimeWarning is not emitted. The no-crash guarantee is still checked by assert_python_ok(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 836ac1f commit ee52c8e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Lib/test/test_tkinter/test_misc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,13 @@ def test_dealloc_in_wrong_thread(self):
7373
""")
7474
rc, out, err = assert_python_ok('-c', script)
7575
self.assertEqual(out.strip(), b'ok')
76-
self.assertIn(b'RuntimeWarning', err)
77-
self.assertIn(b'gh-83274', err)
76+
if not support.Py_GIL_DISABLED:
77+
# On the free-threaded build the interpreter may instead be
78+
# deallocated in its own thread (deferred reference counting), so
79+
# the warning is not necessarily emitted. The crucial guarantee --
80+
# no crash -- is already checked by assert_python_ok() above.
81+
self.assertIn(b'RuntimeWarning', err)
82+
self.assertIn(b'gh-83274', err)
7883

7984
@requires_tk(8, 6, 6)
8085
def test_tk_busy(self):

0 commit comments

Comments
 (0)