From 90c67b40c376c477f2377068c41612c95d8af707 2019-06-19 02:31:35 From: Matthias Bussonnier Date: 2019-06-19 02:31:35 Subject: [PATCH] Restore trace function after exiting debugger. This should bump coverage; as pdb test where removing the coverage function. --- diff --git a/IPython/core/magics/execution.py b/IPython/core/magics/execution.py index 393ee9b..0a7ea0e 100644 --- a/IPython/core/magics/execution.py +++ b/IPython/core/magics/execution.py @@ -934,6 +934,7 @@ python-profiler package from non-free.""") deb._exec_filename = filename while True: try: + trace = sys.gettrace() deb.run(code, code_ns) except Restart: print("Restarting") @@ -943,6 +944,8 @@ python-profiler package from non-free.""") continue else: break + finally: + sys.settrace(trace) except: