File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -247,13 +247,19 @@ def raising_input(msg="", called=[0]):
247247 else :
248248 raise AssertionError ("input() should only be called once!" )
249249
250- with patch .object (builtins , "input" , raising_input ):
251- debugger .InterruptiblePdb ().set_trace ()
252- # The way this test will fail is by set_trace() never exiting,
253- # resulting in a timeout by the test runner. The alternative
254- # implementation would involve a subprocess, but that adds issues with
255- # interrupting subprocesses that are rather complex, so it's simpler
256- # just to do it this way.
250+ tracer_orig = sys .gettrace ()
251+ try :
252+ with patch .object (builtins , "input" , raising_input ):
253+ debugger .InterruptiblePdb ().set_trace ()
254+ # The way this test will fail is by set_trace() never exiting,
255+ # resulting in a timeout by the test runner. The alternative
256+ # implementation would involve a subprocess, but that adds issues
257+ # with interrupting subprocesses that are rather complex, so it's
258+ # simpler just to do it this way.
259+ finally :
260+ # restore the original trace function
261+ sys .settrace (tracer_orig )
262+
257263
258264@skip_win32
259265def test_xmode_skip ():
You can’t perform that action at this time.
0 commit comments