summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorCharles Machalow <csm10495@gmail.com>2023-04-04 22:24:13 (GMT)
committerGitHub <noreply@github.com>2023-04-04 22:24:13 (GMT)
commit935aa452359ac3f79febefcdb4387b962cf528af (patch)
tree31700f3b8d0dfb85e7267ffcfd5330237df212f1 /Modules/clinic
parentf184abbdc9ac3a5656de5f606faf505aa42ff391 (diff)
downloadcpython-935aa452359ac3f79febefcdb4387b962cf528af.zip
cpython-935aa452359ac3f79febefcdb4387b962cf528af.tar.gz
cpython-935aa452359ac3f79febefcdb4387b962cf528af.tar.bz2
GH-75586: Make shutil.which() on Windows more consistent with the OS (GH-103179)
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/_winapi.c.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h
index 891b3f8..7bc63e6 100644
--- a/Modules/clinic/_winapi.c.h
+++ b/Modules/clinic/_winapi.c.h
@@ -1371,4 +1371,44 @@ _winapi__mimetypes_read_windows_registry(PyObject *module, PyObject *const *args
exit:
return return_value;
}
-/*[clinic end generated code: output=edb1a9d1bbfd6394 input=a9049054013a1b77]*/
+
+PyDoc_STRVAR(_winapi_NeedCurrentDirectoryForExePath__doc__,
+"NeedCurrentDirectoryForExePath($module, exe_name, /)\n"
+"--\n"
+"\n");
+
+#define _WINAPI_NEEDCURRENTDIRECTORYFOREXEPATH_METHODDEF \
+ {"NeedCurrentDirectoryForExePath", (PyCFunction)_winapi_NeedCurrentDirectoryForExePath, METH_O, _winapi_NeedCurrentDirectoryForExePath__doc__},
+
+static int
+_winapi_NeedCurrentDirectoryForExePath_impl(PyObject *module,
+ LPCWSTR exe_name);
+
+static PyObject *
+_winapi_NeedCurrentDirectoryForExePath(PyObject *module, PyObject *arg)
+{
+ PyObject *return_value = NULL;
+ LPCWSTR exe_name = NULL;
+ int _return_value;
+
+ if (!PyUnicode_Check(arg)) {
+ _PyArg_BadArgument("NeedCurrentDirectoryForExePath", "argument", "str", arg);
+ goto exit;
+ }
+ exe_name = PyUnicode_AsWideCharString(arg, NULL);
+ if (exe_name == NULL) {
+ goto exit;
+ }
+ _return_value = _winapi_NeedCurrentDirectoryForExePath_impl(module, exe_name);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyBool_FromLong((long)_return_value);
+
+exit:
+ /* Cleanup for exe_name */
+ PyMem_Free((void *)exe_name);
+
+ return return_value;
+}
+/*[clinic end generated code: output=96ea65ece7912d0a input=a9049054013a1b77]*/