Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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()