Skip to content

Commit

Permalink
pythongh-100256: Skip inaccessible registry keys in the WinAPI mimety…
Browse files Browse the repository at this point in the history
…pe implementation (pythonGH-122047)

(cherry picked from commit 0bd9375)

Co-authored-by: Lucas Esposito <LucasEsposito@users.noreply.github.com>
  • Loading branch information
LucasEsposito authored and miss-islington committed Aug 7, 2024
1 parent 9fb6bfb commit b8950cb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ Michael Ernst
Ben Escoto
Andy Eskilsson
André Espaze
Lucas Esposito
Stefan Esser
Nicolas Estibals
Jonathan Eunice
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:mod:`mimetypes` no longer fails when it encounters an inaccessible registry key.
2 changes: 1 addition & 1 deletion Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b8950cb

Please sign in to comment.