diff --git a/pytensor/utils.py b/pytensor/utils.py index 01eb06f2e2..63f71a02c4 100644 --- a/pytensor/utils.py +++ b/pytensor/utils.py @@ -137,13 +137,6 @@ def subprocess_Popen(command: str | list[str], **params): except AttributeError: startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW # type: ignore[attr-defined] - # Anaconda for Windows does not always provide .exe files - # in the PATH, they also have .bat files that call the corresponding - # executable. For instance, "g++.bat" is in the PATH, not "g++.exe" - # Unless "shell=True", "g++.bat" is not executed when trying to - # execute "g++" without extensions. - # (Executing "g++.bat" explicitly would also work.) - params["shell"] = True # "If shell is True, it is recommended to pass args as a string rather than as a sequence." (cite taken from https://docs.python.org/2/library/subprocess.html#frequently-used-arguments) # In case when command arguments have spaces, passing a command as a list will result in incorrect arguments break down, and consequently # in "The filename, directory name, or volume label syntax is incorrect" error message. @@ -151,20 +144,7 @@ def subprocess_Popen(command: str | list[str], **params): if isinstance(command, list): command = " ".join(command) - # Using the dummy file descriptors below is a workaround for a - # crash experienced in an unusual Python 2.4.4 Windows environment - # with the default None values. - stdin = None - if "stdin" not in params: - stdin = Path(os.devnull).open() - params["stdin"] = stdin.fileno() - - try: - proc = subprocess.Popen(command, startupinfo=startupinfo, **params) - finally: - if stdin is not None: - stdin.close() - return proc + return subprocess.Popen(command, startupinfo=startupinfo, **params) def call_subprocess_Popen(command, **params): diff --git a/tests/compile/function/test_function.py b/tests/compile/function/test_function.py index d1f94dd689..b4748e78c5 100644 --- a/tests/compile/function/test_function.py +++ b/tests/compile/function/test_function.py @@ -1,5 +1,4 @@ import pickle -import re import shutil import tempfile from pathlib import Path @@ -50,8 +49,7 @@ def test_function_name(): x = vector("x") func = function([x], x + 1.0) - regex = re.compile(f".*{__file__}c?") - assert regex.match(func.name) is not None + assert __file__ in func.name def test_trust_input():