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

This commit is contained in:
Lucas Esposito 2024-08-07 17:07:26 +02:00 committed by GitHub
parent c25898d51e
commit 0bd93755f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View File

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

View File

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

View File

@ -2803,7 +2803,7 @@ _winapi__mimetypes_read_windows_registry_impl(PyObject *module,
} }
err = RegOpenKeyExW(hkcr, ext, 0, KEY_READ, &subkey); 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; err = ERROR_SUCCESS;
continue; continue;
} else if (err != ERROR_SUCCESS) { } else if (err != ERROR_SUCCESS) {