Skip to content

Commit 8f4892a

Browse files
gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047)
(cherry picked from commit 0bd9375) Co-authored-by: Lucas Esposito <[email protected]>
1 parent 2e82353 commit 8f4892a

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ Michael Ernst
516516
Ben Escoto
517517
Andy Eskilsson
518518
André Espaze
519+
Lucas Esposito
519520
Stefan Esser
520521
Nicolas Estibals
521522
Jonathan Eunice
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:mod:`mimetypes` no longer fails when it encounters an inaccessible registry key.

Modules/_winapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ _winapi__mimetypes_read_windows_registry_impl(PyObject *module,
22682268
}
22692269

22702270
err = RegOpenKeyExW(hkcr, ext, 0, KEY_READ, &subkey);
2271-
if (err == ERROR_FILE_NOT_FOUND) {
2271+
if (err == ERROR_FILE_NOT_FOUND || err == ERROR_ACCESS_DENIED) {
22722272
err = ERROR_SUCCESS;
22732273
continue;
22742274
} else if (err != ERROR_SUCCESS) {

0 commit comments

Comments
 (0)