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

Method temporary_pycache_prefix

Lib/test/test_compileall.py:544–555  ·  view source on GitHub ↗

Adjust and restore sys.pycache_prefix.

(self)

Source from the content-addressed store, hash-verified

542
543 @contextlib.contextmanager
544 def temporary_pycache_prefix(self):
545 """Adjust and restore sys.pycache_prefix."""
546 old_prefix = sys.pycache_prefix
547 new_prefix = os.path.join(self.directory, '__testcache__')
548 try:
549 sys.pycache_prefix = new_prefix
550 yield {
551 'PYTHONPATH': self.directory,
552 'PYTHONPYCACHEPREFIX': new_prefix,
553 }
554 finally:
555 sys.pycache_prefix = old_prefix
556
557 def _get_run_args(self, args):
558 return [*support.optim_args_from_interpreter_flags(),

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected