]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation...
authorLucas Esposito <LucasEsposito@users.noreply.github.com>
Wed, 7 Aug 2024 15:07:26 +0000 (17:07 +0200)
committerGitHub <noreply@github.com>
Wed, 7 Aug 2024 15:07:26 +0000 (16:07 +0100)
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 6008f9e1770d1d4ae3605f7e9d18461714486db4..b031eb7c11f73f5da4448a7e4007fe20543928c6 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -521,6 +521,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 c90d6c5a9ef3ef3ba10195359bd752f09bff1dd6..a330b3ff68db622cbaccb565d46d21115a2feaa3 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) {