MCPcopy Index your code
hub / github.com/python/cpython / debug_script

Function debug_script

Lib/doctest.py:2822–2840  ·  view source on GitHub ↗

Debug a test script. `src` is the script, as a string.

(src, pm=False, globs=None)

Source from the content-addressed store, hash-verified

2820 debug_script(testsrc, pm, globs)
2821
2822def debug_script(src, pm=False, globs=None):
2823 "Debug a test script. `src` is the script, as a string."
2824 import pdb
2825
2826 if globs:
2827 globs = globs.copy()
2828 else:
2829 globs = {}
2830
2831 if pm:
2832 try:
2833 exec(src, globs, globs)
2834 except:
2835 print(sys.exc_info()[1])
2836 p = pdb.Pdb(nosigint=True)
2837 p.reset()
2838 p.interaction(None, sys.exc_info()[2])
2839 else:
2840 pdb.Pdb(nosigint=True).run("exec(%r)" % src, globs, globs)
2841
2842def debug(module, name, pm=False):
2843 """Debug a single doctest docstring.

Callers 2

debug_srcFunction · 0.85
debugFunction · 0.85

Calls 4

resetMethod · 0.95
interactionMethod · 0.95
copyMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…