MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / _ModifiedArgv0

Class _ModifiedArgv0

_pydevd_bundle/pydevd_runpy.py:84–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83
84class _ModifiedArgv0(object):
85 def __init__(self, value):
86 self.value = value
87 self._saved_value = self._sentinel = object()
88
89 def __enter__(self):
90 if self._saved_value is not self._sentinel:
91 raise RuntimeError("Already preserving saved value")
92 self._saved_value = sys.argv[0]
93 sys.argv[0] = self.value
94
95 def __exit__(self, *args):
96 self.value = self._sentinel
97 sys.argv[0] = self._saved_value
98
99
100# TODO: Replace these helpers with importlib._bootstrap_external functions.

Callers 2

_run_module_codeFunction · 0.85
run_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected