File tree 1 file changed +13
-6
lines changed
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):
91
91
_warnings_showwarning = None
92
92
93
93
capture_warnings (True )
94
- tcl = tkinter .Tcl ()
95
94
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" )
101
108
102
109
# Thread shared globals: Establish a queue between a subthread (which handles
103
110
# the socket) and the main thread (which runs user code), plus global
You can’t perform that action at this time.
0 commit comments