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

Method _runscript

Lib/pdb.py:1557–1581  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

1555 self.run(code)
1556
1557 def _runscript(self, filename):
1558 # The script has to run in __main__ namespace (or imports from
1559 # __main__ will break).
1560 #
1561 # So we clear up the __main__ and set several special variables
1562 # (this gets rid of pdb's globals and cleans old variables on restarts).
1563 import __main__
1564 __main__.__dict__.clear()
1565 __main__.__dict__.update({"__name__" : "__main__",
1566 "__file__" : filename,
1567 "__builtins__": __builtins__,
1568 })
1569
1570 # When bdb sets tracing, a number of call and line events happens
1571 # BEFORE debugger even reaches user's code (and the exact sequence of
1572 # events depends on python version). So we take special measures to
1573 # avoid stopping before we reach the main script (see user_line and
1574 # user_call for details).
1575 self._wait_for_mainpyfile = True
1576 self.mainpyfile = self.canonic(filename)
1577 self._user_requested_quit = False
1578 with io.open_code(filename) as fp:
1579 statement = "exec(compile(%r, %r, 'exec'))" % \
1580 (fp.read(), self.mainpyfile)
1581 self.run(statement)
1582
1583# Collect all command help into docstring, if not run with -OO
1584

Callers 1

mainFunction · 0.95

Calls 5

canonicMethod · 0.80
clearMethod · 0.45
updateMethod · 0.45
readMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected