mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-99442: Fix handling in py.exe launcher when argv[0] does not include a file extension (GH-99542)
This commit is contained in:
parent
4f5e1cb00a
commit
a220c6d1ee
3 changed files with 44 additions and 51 deletions
|
@ -173,7 +173,7 @@ class RunPyMixin:
|
|||
errors="ignore",
|
||||
) as p:
|
||||
p.stdin.close()
|
||||
version = next(p.stdout).splitlines()[0].rpartition(" ")[2]
|
||||
version = next(p.stdout, "\n").splitlines()[0].rpartition(" ")[2]
|
||||
p.stdout.read()
|
||||
p.wait(10)
|
||||
if not sys.version.startswith(version):
|
||||
|
@ -467,6 +467,15 @@ class TestLauncher(unittest.TestCase, RunPyMixin):
|
|||
self.assertEqual("3.100-arm64", data["SearchInfo.tag"])
|
||||
self.assertEqual("X.Y-arm64.exe -X fake_arg_for_test -arg", data["stdout"].strip())
|
||||
|
||||
def test_py_default_short_argv0(self):
|
||||
with self.py_ini(TEST_PY_COMMANDS):
|
||||
for argv0 in ['"py.exe"', 'py.exe', '"py"', 'py']:
|
||||
with self.subTest(argv0):
|
||||
data = self.run_py(["--version"], argv=f'{argv0} --version')
|
||||
self.assertEqual("PythonTestSuite", data["SearchInfo.company"])
|
||||
self.assertEqual("3.100", data["SearchInfo.tag"])
|
||||
self.assertEqual(f'X.Y.exe --version', data["stdout"].strip())
|
||||
|
||||
def test_py_default_in_list(self):
|
||||
data = self.run_py(["-0"], env=TEST_PY_ENV)
|
||||
default = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue