summaryrefslogtreecommitdiffstats
path: root/Modules/getpath.c
diff options
context:
space:
mode:
authorMax Bachmann <kontakt@maxbachmann.de>2023-03-01 00:31:21 (GMT)
committerGitHub <noreply@github.com>2023-03-01 00:31:21 (GMT)
commit938e36f824c5f834d6b77d47942ad81edd5491d0 (patch)
tree50995f866619e76b3ce900c60859ab64e4e0621c /Modules/getpath.c
parent360ef843d8fc03aad38ed84f9f45026ab08ca4f4 (diff)
downloadcpython-938e36f824c5f834d6b77d47942ad81edd5491d0.zip
cpython-938e36f824c5f834d6b77d47942ad81edd5491d0.tar.gz
cpython-938e36f824c5f834d6b77d47942ad81edd5491d0.tar.bz2
gh-102336: Remove code specifically for handling Windows 7 (GH-102337)
Diffstat (limited to 'Modules/getpath.c')
-rw-r--r--Modules/getpath.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 13db010..c807a3c 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -227,12 +227,11 @@ getpath_isxfile(PyObject *Py_UNUSED(self), PyObject *args)
path = PyUnicode_AsWideCharString(pathobj, &cchPath);
if (path) {
#ifdef MS_WINDOWS
- const wchar_t *ext;
DWORD attr = GetFileAttributesW(path);
r = (attr != INVALID_FILE_ATTRIBUTES) &&
!(attr & FILE_ATTRIBUTE_DIRECTORY) &&
- SUCCEEDED(PathCchFindExtension(path, cchPath + 1, &ext)) &&
- (CompareStringOrdinal(ext, -1, L".exe", -1, 1 /* ignore case */) == CSTR_EQUAL)
+ (cchPath >= 4) &&
+ (CompareStringOrdinal(path + cchPath - 4, -1, L".exe", -1, 1 /* ignore case */) == CSTR_EQUAL)
? Py_True : Py_False;
#else
struct stat st;