summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2021-04-09 22:06:17 (GMT)
committerGitHub <noreply@github.com>2021-04-09 22:06:17 (GMT)
commiteed7686e9fe22a3eb5e1a1fc7d27c27fca070bd1 (patch)
tree3a33f24fca58c581d025a99d320293145b85d5e7 /Modules/clinic
parentffb05bbb30fa82dbe887981bdabd65af7daffcd1 (diff)
downloadcpython-eed7686e9fe22a3eb5e1a1fc7d27c27fca070bd1.zip
cpython-eed7686e9fe22a3eb5e1a1fc7d27c27fca070bd1.tar.gz
cpython-eed7686e9fe22a3eb5e1a1fc7d27c27fca070bd1.tar.bz2
bpo-43105: Importlib now resolves relative paths when creating module spec objects from file locations (GH-25121)
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/posixmodule.c.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index 09ecdb3..042eb4b 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -1311,6 +1311,47 @@ exit:
#endif /* defined(MS_WINDOWS) */
+#if defined(MS_WINDOWS)
+
+PyDoc_STRVAR(os__path_splitroot__doc__,
+"_path_splitroot($module, /, path)\n"
+"--\n"
+"\n"
+"Removes everything after the root on Win32.");
+
+#define OS__PATH_SPLITROOT_METHODDEF \
+ {"_path_splitroot", (PyCFunction)(void(*)(void))os__path_splitroot, METH_FASTCALL|METH_KEYWORDS, os__path_splitroot__doc__},
+
+static PyObject *
+os__path_splitroot_impl(PyObject *module, path_t *path);
+
+static PyObject *
+os__path_splitroot(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"path", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_path_splitroot", 0};
+ PyObject *argsbuf[1];
+ path_t path = PATH_T_INITIALIZE("_path_splitroot", "path", 0, 0);
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &path)) {
+ goto exit;
+ }
+ return_value = os__path_splitroot_impl(module, &path);
+
+exit:
+ /* Cleanup for path */
+ path_cleanup(&path);
+
+ return return_value;
+}
+
+#endif /* defined(MS_WINDOWS) */
+
PyDoc_STRVAR(os_mkdir__doc__,
"mkdir($module, /, path, mode=511, *, dir_fd=None)\n"
"--\n"
@@ -8264,6 +8305,10 @@ exit:
#define OS__GETVOLUMEPATHNAME_METHODDEF
#endif /* !defined(OS__GETVOLUMEPATHNAME_METHODDEF) */
+#ifndef OS__PATH_SPLITROOT_METHODDEF
+ #define OS__PATH_SPLITROOT_METHODDEF
+#endif /* !defined(OS__PATH_SPLITROOT_METHODDEF) */
+
#ifndef OS_NICE_METHODDEF
#define OS_NICE_METHODDEF
#endif /* !defined(OS_NICE_METHODDEF) */
@@ -8723,4 +8768,4 @@ exit:
#ifndef OS__REMOVE_DLL_DIRECTORY_METHODDEF
#define OS__REMOVE_DLL_DIRECTORY_METHODDEF
#endif /* !defined(OS__REMOVE_DLL_DIRECTORY_METHODDEF) */
-/*[clinic end generated code: output=edb5a840b51fcaa8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=579785e080461faa input=a9049054013a1b77]*/