当前位置: 首页>>代码示例>>Python>>正文


Python pdb._user_requested_quit方法代码示例

本文整理汇总了Python中pdb._user_requested_quit方法的典型用法代码示例。如果您正苦于以下问题:Python pdb._user_requested_quit方法的具体用法?Python pdb._user_requested_quit怎么用?Python pdb._user_requested_quit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pdb的用法示例。


在下文中一共展示了pdb._user_requested_quit方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _runscript

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def _runscript(self, filename):
        # The script has to run in __main__ namespace (or imports from
        # __main__ will break).
        #
        # So we clear up the __main__ and set several special variables
        # (this gets rid of pdb's globals and cleans old variables on restarts).
        import __main__
        __main__.__dict__.clear()
        __main__.__dict__.update({"__name__"    : "__main__",
                                  "__file__"    : filename,
                                  "__builtins__": __builtins__,
                                 })

        # When bdb sets tracing, a number of call and line events happens
        # BEFORE debugger even reaches user's code (and the exact sequence of
        # events depends on python version). So we take special measures to
        # avoid stopping before we reach the main script (see user_line and
        # user_call for details).
        self._wait_for_mainpyfile = 1
        self.mainpyfile = self.canonic(filename)
        self._user_requested_quit = 0
        statement = 'execfile( "%s")' % filename
        self.run(statement)

# Simplified interface 
开发者ID:glmcdona,项目名称:meddle,代码行数:27,代码来源:pdb.py

示例2: _runscript

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def _runscript(self, filename):
        # The script has to run in __main__ namespace (or imports from
        # __main__ will break).
        #
        # So we clear up the __main__ and set several special variables
        # (this gets rid of pdb's globals and cleans old variables on restarts).
        import __main__
        __main__.__dict__.clear()
        __main__.__dict__.update({"__name__"    : "__main__",
                                  "__file__"    : filename,
                                  "__builtins__": __builtins__,
                                 })

        # When bdb sets tracing, a number of call and line events happens
        # BEFORE debugger even reaches user's code (and the exact sequence of
        # events depends on python version). So we take special measures to
        # avoid stopping before we reach the main script (see user_line and
        # user_call for details).
        self._wait_for_mainpyfile = 1
        self.mainpyfile = self.canonic(filename)
        self._user_requested_quit = 0
        statement = 'execfile(%r)' % filename
        self.run(statement)

# Simplified interface 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:27,代码来源:pdb.py

示例3: _runmodule

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def _runmodule(self, module_name):
        self._wait_for_mainpyfile = True
        self._user_requested_quit = False
        import runpy
        mod_name, mod_spec, code = runpy._get_module_details(module_name)
        self.mainpyfile = self.canonic(code.co_filename)
        import __main__
        __main__.__dict__.clear()
        __main__.__dict__.update({
            "__name__": "__main__",
            "__file__": self.mainpyfile,
            "__package__": mod_spec.parent,
            "__loader__": mod_spec.loader,
            "__spec__": mod_spec,
            "__builtins__": __builtins__,
        })
        self.run(code) 
开发者ID:CedricGuillemet,项目名称:Imogen,代码行数:19,代码来源:pdb.py

示例4: run_in_pdb

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def run_in_pdb(func, args):
    def debug_signal_handler(signal, frame):
        import pdb
        pdb.set_trace()
    import signal
    signal.signal(signal.SIGINT, debug_signal_handler)

    import pdb as pdb_module

    import sys
    import traceback
    pdb = pdb_module.Pdb()
    while True:
        try:
            pdb.runcall(func, args)
            if pdb._user_requested_quit:
                break
            print("The program finished and will be restarted")
        except pdb_module.Restart:
            print("Restarting with arguments:")
            print("\t" + " ".join(sys.argv[1:]))
        except SystemExit:
            # In most cases SystemExit does not warrant a post-mortem session.
            print("The program exited via sys.exit(). Exit status: ",)
            print(sys.exc_info()[1])
        except SyntaxError:
            traceback.print_exc()
            sys.exit(1)
        except BaseException:
            traceback.print_exc()
            print("Uncaught exception. Entering post mortem debugging")
            print("Running 'cont' or 'step' will restart the program")
            t = sys.exc_info()[2]
            pdb.interaction(None, t)
            print("Post mortem debugger finished. The program will be restarted") 
开发者ID:fabiencro,项目名称:knmt,代码行数:37,代码来源:__main__.py

示例5: do_quit

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def do_quit(self, arg):
        self._user_requested_quit = 1
        self.set_quit()
        return 1 
开发者ID:glmcdona,项目名称:meddle,代码行数:6,代码来源:pdb.py

示例6: do_EOF

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def do_EOF(self, arg):
        print >>self.stdout
        self._user_requested_quit = 1
        self.set_quit()
        return 1 
开发者ID:glmcdona,项目名称:meddle,代码行数:7,代码来源:pdb.py

示例7: do_quit

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def do_quit(self, arg):
        """q(uit)\nexit
        Quit from the debugger. The program being executed is aborted.
        """
        self._user_requested_quit = True
        self.set_quit()
        return 1 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:pdb.py

示例8: do_EOF

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def do_EOF(self, arg):
        """EOF
        Handles the receipt of EOF as a command.
        """
        self.message('')
        self._user_requested_quit = True
        self.set_quit()
        return 1 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:10,代码来源:pdb.py

示例9: _runscript

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import _user_requested_quit [as 别名]
def _runscript(self, filename):
        # The script has to run in __main__ namespace (or imports from
        # __main__ will break).
        #
        # So we clear up the __main__ and set several special variables
        # (this gets rid of pdb's globals and cleans old variables on restarts).
        import __main__
        __main__.__dict__.clear()
        __main__.__dict__.update({"__name__"    : "__main__",
                                  "__file__"    : filename,
                                  "__builtins__": __builtins__,
                                 })

        # When bdb sets tracing, a number of call and line events happens
        # BEFORE debugger even reaches user's code (and the exact sequence of
        # events depends on python version). So we take special measures to
        # avoid stopping before we reach the main script (see user_line and
        # user_call for details).
        self._wait_for_mainpyfile = True
        self.mainpyfile = self.canonic(filename)
        self._user_requested_quit = False
        with open(filename, "rb") as fp:
            statement = "exec(compile(%r, %r, 'exec'))" % \
                        (fp.read(), self.mainpyfile)
        self.run(statement)

# Collect all command help into docstring, if not run with -OO 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:29,代码来源:pdb.py


注:本文中的pdb._user_requested_quit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。