gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047)

(cherry picked from commit 0bd93755f3)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-08-07 20:39:51 +02:00 committed by GitHub
parent 2e8235302b
commit 8f4892ac52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View file

@ -516,6 +516,7 @@ Michael Ernst
Ben Escoto
Andy Eskilsson
André Espaze
Lucas Esposito
Stefan Esser
Nicolas Estibals
Jonathan Eunice

View file

@ -0,0 +1 @@
:mod:`mimetypes` no longer fails when it encounters an inaccessible registry key.

View file

@ -2268,7 +2268,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) {