Skip to content

Commit 0bd9375

Browse files
gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047)
1 parent c25898d commit 0bd9375

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
@@ -521,6 +521,7 @@ Michael Ernst
521521
Ben Escoto
522522
Andy Eskilsson
523523
André Espaze
524+
Lucas Esposito
524525
Stefan Esser
525526
Nicolas Estibals
526527
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
@@ -2803,7 +2803,7 @@ _winapi__mimetypes_read_windows_registry_impl(PyObject *module,
28032803
}
28042804

28052805
err = RegOpenKeyExW(hkcr, ext, 0, KEY_READ, &subkey);
2806-
if (err == ERROR_FILE_NOT_FOUND) {
2806+
if (err == ERROR_FILE_NOT_FOUND || err == ERROR_ACCESS_DENIED) {
28072807
err = ERROR_SUCCESS;
28082808
continue;
28092809
} else if (err != ERROR_SUCCESS) {

0 commit comments

Comments
 (0)