Skip to content

Commit a40a270

Browse files
gh-151678: Skip the grab_set_global error path off X11
Grabbing a non-viewable window raises "grab failed" only on X11; on Aqua and Windows it would instead grab the whole display, so test only the portable TypeError path there. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent cafc8ae commit a40a270

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_tkinter/test_misc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,13 @@ def handler(offset, length):
490490
def test_grab_set_global(self):
491491
# A successful global grab directs all events on the display to this
492492
# application, so only the error paths are tested here.
493+
self.assertRaises(TypeError, self.root.grab_set_global, 'extra')
494+
if self.root._windowingsystem != 'x11':
495+
# Grabbing a non-viewable window fails only on X11; elsewhere it
496+
# would actually grab the whole display.
497+
self.skipTest('grab on a non-viewable window fails only on X11')
493498
f = tkinter.Frame(self.root) # not yet viewable
494499
self.assertRaisesRegex(TclError, 'grab failed', f.grab_set_global)
495-
self.assertRaises(TypeError, self.root.grab_set_global, 'extra')
496500

497501
def test_send(self):
498502
if self.root._windowingsystem != 'x11':

0 commit comments

Comments
 (0)