https://github.com/python/cpython/commit/f07039866949919183135297bfb37a75b9da3ddf
commit: f07039866949919183135297bfb37a75b9da3ddf
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: Yhg1s <[email protected]>
date: 2024-09-02T12:58:53+02:00
summary:

[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 0bd93755f37e6b8beb597787fce39eb141179965)

Co-authored-by: Lucas Esposito <[email protected]>

files:
A Misc/NEWS.d/next/Windows/2024-07-19-21-50-54.gh-issue-100256.GDrKba.rst
M Misc/ACKS
M Modules/_winapi.c

diff --git a/Misc/ACKS b/Misc/ACKS
index 80504a16bce64f..694654e555aa33 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -520,6 +520,7 @@ Michael Ernst
 Ben Escoto
 Andy Eskilsson
 André Espaze
+Lucas Esposito
 Stefan Esser
 Nicolas Estibals
 Jonathan Eunice
diff --git 
a/Misc/NEWS.d/next/Windows/2024-07-19-21-50-54.gh-issue-100256.GDrKba.rst 
b/Misc/NEWS.d/next/Windows/2024-07-19-21-50-54.gh-issue-100256.GDrKba.rst
new file mode 100644
index 00000000000000..f0156ddd4772ed
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2024-07-19-21-50-54.gh-issue-100256.GDrKba.rst
@@ -0,0 +1 @@
+:mod:`mimetypes` no longer fails when it encounters an inaccessible registry 
key.
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 8794d568e92a36..71bddd2f697df4 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -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) {

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to