當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。