File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -91,13 +91,20 @@ def capture_warnings(capture):
9191 _warnings_showwarning = None
9292
9393capture_warnings (True )
94- tcl = tkinter .Tcl ()
9594
96- def handle_tk_events (tcl = tcl ):
97- """Process any tk events that are ready to be dispatched if tkinter
98- has been imported, a tcl interpreter has been created and tk has been
99- loaded."""
100- tcl .eval ("update" )
95+ if idlelib .testing :
96+ # gh-121008: When testing IDLE, don't create a Tk object to avoid side
97+ # effects such as installing a PyOS_InputHook hook.
98+ def handle_tk_events ():
99+ pass
100+ else :
101+ tcl = tkinter .Tcl ()
102+
103+ def handle_tk_events (tcl = tcl ):
104+ """Process any tk events that are ready to be dispatched if tkinter
105+ has been imported, a tcl interpreter has been created and tk has been
106+ loaded."""
107+ tcl .eval ("update" )
101108
102109# Thread shared globals: Establish a queue between a subthread (which handles
103110# the socket) and the main thread (which runs user code), plus global
You can’t perform that action at this time.
0 commit comments