From 77c24577a9022427c067669fc67cadd7163f20f8 Mon Sep 17 00:00:00 2001 From: rhettcarillo Date: Thu, 13 Aug 2026 05:32:42 +0400 Subject: [PATCH] Use an argument list in test_typing_extensions_compiles_with_opt The test built a shell command string from sys.executable and typing_extensions.__file__ without quoting either. When the checkout or the interpreter lives under a path containing a space, the shell splits the path and the subprocess fails for that reason alone -- and because the except clause maps any CalledProcessError to "Module does not compile with optimize=2", the failure is indistinguishable from a real -OO compilation error. An argument list needs no quoting and no shell, so the test measures what it means to measure on every path. Co-Authored-By: Claude Fable 5 --- src/test_typing_extensions.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py index 938f2acc..48107c04 100644 --- a/src/test_typing_extensions.py +++ b/src/test_typing_extensions.py @@ -7221,9 +7221,8 @@ def test_alias_names_still_exist(self): def test_typing_extensions_compiles_with_opt(self): file_path = typing_extensions.__file__ try: - subprocess.check_output(f'{sys.executable} -OO {file_path}', - stderr=subprocess.STDOUT, - shell=True) + subprocess.check_output([sys.executable, '-OO', file_path], + stderr=subprocess.STDOUT) except subprocess.CalledProcessError: # pragma: no cover self.fail('Module does not compile with optimize=2 (-OO flag).')