def _debug_event(event): """ custom binding for pudb, to allow debugging a statement and also post-mortem debugging in case of any exception """ b = event.cli.current_buffer app = get_app() statements = b.document.text if statements: import linecache linecache.cache["<string>"] = (len(statements), time.time(), statements.split("\n"), "<string>") app.exit(pudb.runstatement(statements)) app.pre_run_callables.append(b.reset) else: pudb.pm()
def _debug_event(event): """ custom binding for pudb, to allow debugging a statement and also post-mortem debugging in case of any exception """ b = event.cli.current_buffer app = get_app() statements = b.document.text.strip() if statements: _globals = repl.get_globals() _globals["_MODULE_SOURCE_CODE"] = statements app.exit( pudb.runstatement(statements, globals=_globals, locals=repl.get_locals())) app.pre_run_callables.append(b.reset) else: pudb.pm()