mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-37369: Fix initialization of sys members when launched via an app container (GH-14428)
sys._base_executable is now always defined on all platforms, and can be overridden through configuration. Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
This commit is contained in:
parent
80097e089b
commit
9048c49322
17 changed files with 410 additions and 277 deletions
|
@ -610,9 +610,10 @@ class CGIHTTPServerTestCase(BaseTestCase):
|
|||
|
||||
# The shebang line should be pure ASCII: use symlink if possible.
|
||||
# See issue #7668.
|
||||
self._pythonexe_symlink = None
|
||||
if support.can_symlink():
|
||||
self.pythonexe = os.path.join(self.parent_dir, 'python')
|
||||
os.symlink(sys.executable, self.pythonexe)
|
||||
self._pythonexe_symlink = support.PythonSymlink(self.pythonexe).__enter__()
|
||||
else:
|
||||
self.pythonexe = sys.executable
|
||||
|
||||
|
@ -655,8 +656,8 @@ class CGIHTTPServerTestCase(BaseTestCase):
|
|||
def tearDown(self):
|
||||
try:
|
||||
os.chdir(self.cwd)
|
||||
if self.pythonexe != sys.executable:
|
||||
os.remove(self.pythonexe)
|
||||
if self._pythonexe_symlink:
|
||||
self._pythonexe_symlink.__exit__(None, None, None)
|
||||
if self.nocgi_path:
|
||||
os.remove(self.nocgi_path)
|
||||
if self.file1_path:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue