summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/_winapi.c.h
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-07-08 16:13:06 (GMT)
committerGitHub <noreply@github.com>2021-07-08 16:13:06 (GMT)
commit08697ac5d1543fca3629c719ab43e50d73021631 (patch)
tree3e574c53fb44c20b85845e6dd47959b562fbc4c0 /Modules/clinic/_winapi.c.h
parenta219d6bc8f07d671d31129e3ec2e8f2e0538ca21 (diff)
downloadcpython-08697ac5d1543fca3629c719ab43e50d73021631.zip
cpython-08697ac5d1543fca3629c719ab43e50d73021631.tar.gz
cpython-08697ac5d1543fca3629c719ab43e50d73021631.tar.bz2
bpo-44582: Accelerate mimetypes.init on Windows with a native accelerator (GH-27059)
(cherry picked from commit bbf2fb6c7ae78f40483606f467739a58cd747270) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Modules/clinic/_winapi.c.h')
-rw-r--r--Modules/clinic/_winapi.c.h38
1 files changed, 37 insertions, 1 deletions
diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h
index a9630d5..5bda156 100644
--- a/Modules/clinic/_winapi.c.h
+++ b/Modules/clinic/_winapi.c.h
@@ -1148,4 +1148,40 @@ _winapi_GetFileType(PyObject *module, PyObject *const *args, Py_ssize_t nargs, P
exit:
return return_value;
}
-/*[clinic end generated code: output=1f10e03f64ff9777 input=a9049054013a1b77]*/
+
+PyDoc_STRVAR(_winapi__mimetypes_read_windows_registry__doc__,
+"_mimetypes_read_windows_registry($module, /, on_type_read)\n"
+"--\n"
+"\n"
+"Optimized function for reading all known MIME types from the registry.\n"
+"\n"
+"*on_type_read* is a callable taking *type* and *ext* arguments, as for\n"
+"MimeTypes.add_type.");
+
+#define _WINAPI__MIMETYPES_READ_WINDOWS_REGISTRY_METHODDEF \
+ {"_mimetypes_read_windows_registry", (PyCFunction)(void(*)(void))_winapi__mimetypes_read_windows_registry, METH_FASTCALL|METH_KEYWORDS, _winapi__mimetypes_read_windows_registry__doc__},
+
+static PyObject *
+_winapi__mimetypes_read_windows_registry_impl(PyObject *module,
+ PyObject *on_type_read);
+
+static PyObject *
+_winapi__mimetypes_read_windows_registry(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ static const char * const _keywords[] = {"on_type_read", NULL};
+ static _PyArg_Parser _parser = {NULL, _keywords, "_mimetypes_read_windows_registry", 0};
+ PyObject *argsbuf[1];
+ PyObject *on_type_read;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ on_type_read = args[0];
+ return_value = _winapi__mimetypes_read_windows_registry_impl(module, on_type_read);
+
+exit:
+ return return_value;
+}
+/*[clinic end generated code: output=ac3623be6e42017c input=a9049054013a1b77]*/