]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38353: Simplify calculate_pybuilddir() (GH-16614)
authorVictor Stinner <vstinner@python.org>
Mon, 7 Oct 2019 10:56:59 +0000 (12:56 +0200)
committerGitHub <noreply@github.com>
Mon, 7 Oct 2019 10:56:59 +0000 (12:56 +0200)
Calling _Py_wfopen() is enough to check if filename is an existing
file or not. There is no need to check first isfile().

Modules/getpath.c

index 993276fdc27d0ca7baedf51cb9614e91e3feb424..057a929019755e8c6dcb59e0b8e852d667c3eb45 100644 (file)
@@ -657,11 +657,6 @@ calculate_pybuilddir(const wchar_t *argv0_path,
         return _PyStatus_NO_MEMORY();
     }
 
-    if (!isfile(filename)) {
-        PyMem_RawFree(filename);
-        return _PyStatus_OK();
-    }
-
     FILE *fp = _Py_wfopen(filename, L"rb");
     PyMem_RawFree(filename);
     if (fp == NULL) {