本文整理汇总了Python中sys.call_tracing函数的典型用法代码示例。如果您正苦于以下问题:Python call_tracing函数的具体用法?Python call_tracing怎么用?Python call_tracing使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call_tracing函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(cls, cmdlineargs, *args, **kwargs):
# print cls
cls._options = filter(
lambda x: isinstance(x, CmdLineOption), map(lambda x: eval("cls." + x, {"cls": cls}), dir(cls))
)
do_parse_options(cls.ProgramMetadata, cls._options)
setprocname(sys.argv[0].split("/")[-1])
if int(cls.debugger_option.value):
if int(cls.debugger_option.value) == 1:
import pdb
try:
pdb.run("cls.prepare_process()", globals(), {"cls": cls})
pdb.run("cls.process()", globals(), {"cls": cls})
pdb.run("cls.finish()", globals(), {"cls": cls})
except:
pdb.post_mortem(sys.exc_info()[2])
elif len(cls.profiler_option):
import cProfile
cProfile.run("cls.prepare_process()", cls.profiler_option + "-prepare")
cProfile.run("cls.process()", cls.profiler_option + "-process")
cProfile.run("cls.finish()", cls.profiler_option + "-finish")
else:
cls.prepare_process()
sys.call_tracing(lambda: cls.process(), [])
cls.finish()
else:
cls.prepare_process()
cls.process()
cls.finish()
开发者ID:matthiascy,项目名称:pycvf,代码行数:31,代码来源:generic_application.py
示例2: debug
def debug(self, arg):
sys.settrace(None)
globals = self.curframe.f_globals
locals = self.curframe.f_locals
p = Debugger()
p.reset()
sys.call_tracing(p.run, (arg, globals, locals))
sys.settrace(self.trace_dispatch)
开发者ID:xiama,项目名称:automations,代码行数:8,代码来源:debugger.py
示例3: recursive
def recursive(self, g, l):
# Inspect curent debugger vars through pdb
sys.settrace(None)
from pdb import Pdb
p = Pdb()
sys.call_tracing(p.run, ('1/0', g, l))
sys.settrace(self.trace_dispatch)
self.lastcmd = p.lastcmd
开发者ID:chiehwen,项目名称:wdb,代码行数:8,代码来源:__init__.py
示例4: _recursive
def _recursive(self, g, l):
"""Inspect wdb with pdb"""
# Inspect curent debugger vars through pdb
sys.settrace(None)
from pdb import Pdb
p = Pdb()
sys.call_tracing(p.run, ("1/0", g, l))
sys.settrace(self.trace_dispatch)
self.lastcmd = p.lastcmd
开发者ID:seletz,项目名称:wdb,代码行数:10,代码来源:__init__.py
示例5: do_debug
def do_debug(self, arg):
sys.settrace(None)
globals = self.curframe.f_globals
locals = self.curframe_locals
p = Pdb(self.completekey, self.stdin, self.stdout)
p.prompt = "(%s) " % self.prompt.strip()
shout >>self.stdout, "ENTERING RECURSIVE DEBUGGER"
sys.call_tracing(p.run, (arg, globals, locals))
shout >>self.stdout, "LEAVING RECURSIVE DEBUGGER"
sys.settrace(self.trace_dispatch)
self.lastcmd = p.lastcmd
开发者ID:dr4ke616,项目名称:custom_python,代码行数:11,代码来源:pdb.py
示例6: do_debug
def do_debug(self, arg):
sys.settrace(None)
globals = self.curframe.f_globals
locals = self.curframe.f_locals
p = Pdb()
p.prompt = "(%s) " % self.prompt.strip()
self.stdout.write("ENTERING RECURSIVE DEBUGGER\n")
sys.call_tracing(p.run, (arg, globals, locals))
self.stdout.write("LEAVING RECURSIVE DEBUGGER\n")
sys.settrace(self.trace_dispatch)
self.lastcmd = p.lastcmd
开发者ID:vim-scripts,项目名称:vdb.vim,代码行数:11,代码来源:cpdb.py
示例7: do_debug
def do_debug(self, arg):
"""debug code
Enter a recursive debugger that steps through the code
argument (which is an arbitrary expression or statement to be
executed in the current environment).
"""
sys.settrace(None)
globals = self.curframe.f_globals
locals = self.curframe_locals
p = self.__class__(completekey=self.completekey,
stdin=self.stdin, stdout=self.stdout)
p.use_rawinput = self.use_rawinput
p.prompt = "(%s) " % self.prompt.strip()
self.message("ENTERING RECURSIVE DEBUGGER")
sys.call_tracing(p.run, (arg, globals, locals))
self.message("LEAVING RECURSIVE DEBUGGER")
sys.settrace(self.trace_dispatch)
self.lastcmd = p.lastcmd
开发者ID:Carreau,项目名称:ipython,代码行数:18,代码来源:debugger.py
示例8: run
def run(self, args):
arg = ' '.join(args[1:])
curframe = self.proc.curframe
if not curframe:
self.msg("No frame selected.")
return
for attr in ('prompt_str', 'frame', 'event', 'event_arg',
'curindex'):
cmd = 'old_%s = self.proc.%s' % (attr, attr)
exec(cmd)
pass
old_lock = self.core.debugger_lock
old_stop_level = self.core.stop_level
old_different_line = self.core.stop_level
self.proc.debug_nest += 1
self.core.debugger_lock = threading.Lock()
self.core.stop_level = None
self.core.different_line = None
global_vars = curframe.f_globals
local_vars = curframe.f_locals
self.section("ENTERING NESTED DEBUGGER")
self.core.step_ignore = 2 # call_tracing will stop in itself.
try:
ret = sys.call_tracing(eval, (arg, global_vars, local_vars))
self.msg("R=> %s" % self.proc._saferepr(ret))
except:
pass
self.section("LEAVING NESTED DEBUGGER")
self.core.debugger_lock = old_lock
self.core.stop_level = old_stop_level
self.core.different_line = old_different_line
self.proc.continue_running = False
self.proc.debug_nest -= 1
for attr in ('prompt_str', 'frame', 'event', 'event_arg',
'curindex'):
cmd = 'self.proc.%s = old_%s' % (attr, attr)
exec(cmd)
pass
if hasattr(self.proc, 'print_location'):
self.proc.print_location()
return False
开发者ID:msabramo,项目名称:python2-trepan,代码行数:48,代码来源:debug.py
示例9: test_call_tracing
def test_call_tracing(self):
def f(i):
return i * 2
def g():
pass
# outside of a traceback
self.assertEqual(10, sys.call_tracing(f, (5, )))
# inside of a traceback
log = []
def thandler(frm, evt, pl):
if evt == 'call':
log.append(frm.f_code.co_name)
if log[-1] == 'g':
sys.call_tracing(f, (5, ))
return thandler
sys.settrace(thandler)
g()
sys.settrace(None)
self.assertEqual(log, ['g', 'f'])
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:23,代码来源:test_sys.py
示例10: test_call_tracing
def test_call_tracing(self):
self.assertEqual(sys.call_tracing(str, (2,)), "2")
self.assertRaises(TypeError, sys.call_tracing, str, 2)
开发者ID:plirof,项目名称:minibloq_v0.83,代码行数:3,代码来源:test_sys.py
示例11: test_call_tracing
def test_call_tracing(self):
if test.test_support.due_to_ironpython_bug("http://ironpython.codeplex.com/workitem/28171"):
return
self.assertEqual(sys.call_tracing(str, (2,)), "2")
self.assertRaises(TypeError, sys.call_tracing, str, 2)
开发者ID:BillyboyD,项目名称:main,代码行数:5,代码来源:test_sys.py
示例12: thandler
def thandler(frm, evt, pl):
if evt == 'call':
log.append(frm.f_code.co_name)
if log[-1] == 'g':
sys.call_tracing(f, (5, ))
return thandler
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:test_sys.py
注:本文中的sys.call_tracing函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论