https://github.com/python/cpython/commit/fff3c4fcac9ecff3d183ca46968ad8b94e364701
commit: fff3c4fcac9ecff3d183ca46968ad8b94e364701
branch: main
author: thexai <[email protected]>
committer: chris-eibl <[email protected]>
date: 2026-09-11T15:35:47+02:00
summary:
gh-152433: Windows: change ``winreg`` to conditional import for UWP
compatibility (#154918)
files:
A Misc/NEWS.d/next/Windows/2026-07-31-18-40-43.gh-issue-152433.Pq3-U-.rst
M Lib/importlib/_bootstrap_external.py
diff --git a/Lib/importlib/_bootstrap_external.py
b/Lib/importlib/_bootstrap_external.py
index 176652230c092a8..484e0457eb0d732 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -33,7 +33,10 @@
_MS_WINDOWS = (sys.platform == 'win32')
if _MS_WINDOWS:
import nt as _os
- import winreg
+ try:
+ import winreg
+ except ImportError:
+ winreg = None
else:
import posix as _os
diff --git
a/Misc/NEWS.d/next/Windows/2026-07-31-18-40-43.gh-issue-152433.Pq3-U-.rst
b/Misc/NEWS.d/next/Windows/2026-07-31-18-40-43.gh-issue-152433.Pq3-U-.rst
new file mode 100644
index 000000000000000..4506bccd6b249a4
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2026-07-31-18-40-43.gh-issue-152433.Pq3-U-.rst
@@ -0,0 +1,2 @@
+Changed :mod:`!winreg` to conditional import for Universal Windows Platform
+compatibility.
_______________________________________________
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]