MCPcopy Index your code
hub / github.com/RustPython/RustPython / debug_script

Function debug_script

Lib/doctest.py:2746–2764  ·  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

2744 debug_script(testsrc, pm, globs)
2745
2746def debug_script(src, pm=False, globs=None):
2747 "Debug a test script. `src` is the script, as a string."
2748 import pdb
2749
2750 if globs:
2751 globs = globs.copy()
2752 else:
2753 globs = {}
2754
2755 if pm:
2756 try:
2757 exec(src, globs, globs)
2758 except:
2759 print(sys.exc_info()[1])
2760 p = pdb.Pdb(nosigint=True)
2761 p.reset()
2762 p.interaction(None, sys.exc_info()[2])
2763 else:
2764 pdb.Pdb(nosigint=True).run("exec(%r)" % src, globs, globs)
2765
2766def debug(module, name, pm=False):
2767 """Debug a single doctest docstring.

Callers 2

debug_srcFunction · 0.85
debugFunction · 0.85

Calls 6

resetMethod · 0.95
interactionMethod · 0.95
execFunction · 0.50
printFunction · 0.50
copyMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected