Skip to content

Commit f070398

Browse files
[3.13] gh-100256: Skip inaccessible registry keys in the WinAPI mimetype implementation (GH-122047) (#122786)
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 f1a6d22 commit f070398

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
@@ -520,6 +520,7 @@ Michael Ernst
520520
Ben Escoto
521521
Andy Eskilsson
522522
André Espaze
523+
Lucas Esposito
523524
Stefan Esser
524525
Nicolas Estibals
525526
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)