[Python-checkins] bpo-38353: Simplify calculate_pybuilddir() (GH-16614)
Victor Stinner
webhook-mailer at python.org
Mon Oct 7 06:57:03 EDT 2019
https://github.com/python/cpython/commit/b96145a6b5d89599ebccd2111d93f5670ddae840
commit: b96145a6b5d89599ebccd2111d93f5670ddae840
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2019-10-07T12:56:59+02:00
summary:
bpo-38353: Simplify calculate_pybuilddir() (GH-16614)
Calling _Py_wfopen() is enough to check if filename is an existing
file or not. There is no need to check first isfile().
files:
M Modules/getpath.c
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 993276fdc27d0..057a929019755 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -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) {
More information about the Python-checkins
mailing list