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

Class _ModifiedArgv0

Lib/runpy.py:49–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 self._saved_module = []
48
49class _ModifiedArgv0(object):
50 def __init__(self, value):
51 self.value = value
52 self._saved_value = self._sentinel = object()
53
54 def __enter__(self):
55 if self._saved_value is not self._sentinel:
56 raise RuntimeError("Already preserving saved value")
57 self._saved_value = sys.argv[0]
58 sys.argv[0] = self.value
59
60 def __exit__(self, *args):
61 self.value = self._sentinel
62 sys.argv[0] = self._saved_value
63
64# TODO: Replace these helpers with importlib._bootstrap_external functions.
65def _run_code(code, run_globals, init_globals=None,

Callers 2

_run_module_codeFunction · 0.85
run_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…