]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementati...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 2 Sep 2024 10:58:53 +0000 (12:58 +0200)
committerGitHub <noreply@github.com>
Mon, 2 Sep 2024 10:58:53 +0000 (12:58 +0200)
gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047)
(cherry picked from commit 0bd93755f37e6b8beb597787fce39eb141179965)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
Misc/ACKS
Misc/NEWS.d/next/Windows/2024-07-19-21-50-54.gh-issue-100256.GDrKba.rst [new file with mode: 0644]
Modules/_winapi.c

index 80504a16bce64feb55142a06134195396fa2989e..694654e555aa33cde9f3ada1df4697a5801d8672 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -520,6 +520,7 @@ Michael Ernst
 Ben Escoto
 Andy Eskilsson
 AndrĂ© Espaze
+Lucas Esposito
 Stefan Esser
 Nicolas Estibals
 Jonathan Eunice
diff --git a/Misc/NEWS.d/next/Windows/2024-07-19-21-50-54.gh-issue-100256.GDrKba.rst b/Misc/NEWS.d/next/Windows/2024-07-19-21-50-54.gh-issue-100256.GDrKba.rst
new file mode 100644 (file)
index 0000000..f0156dd
--- /dev/null
@@ -0,0 +1 @@
+:mod:`mimetypes` no longer fails when it encounters an inaccessible registry key.
index 8794d568e92a367ec18e55324312ebfaf35a9731..71bddd2f697df44798e3d0d82ef08e66b4b23da0 100644 (file)
@@ -2803,7 +2803,7 @@ _winapi__mimetypes_read_windows_registry_impl(PyObject *module,
         }
 
         err = RegOpenKeyExW(hkcr, ext, 0, KEY_READ, &subkey);
-        if (err == ERROR_FILE_NOT_FOUND) {
+        if (err == ERROR_FILE_NOT_FOUND || err == ERROR_ACCESS_DENIED) {
             err = ERROR_SUCCESS;
             continue;
         } else if (err != ERROR_SUCCESS) {