Skip to content

Commit fff3c4f

Browse files
authored
gh-152433: Windows: change winreg to conditional import for UWP compatibility (#154918)
1 parent 5172fa4 commit fff3c4f

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/importlib/_bootstrap_external.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
_MS_WINDOWS = (sys.platform == 'win32')
3434
if _MS_WINDOWS:
3535
import nt as _os
36-
import winreg
36+
try:
37+
import winreg
38+
except ImportError:
39+
winreg = None
3740
else:
3841
import posix as _os
3942

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Changed :mod:`!winreg` to conditional import for Universal Windows Platform
2+
compatibility.

0 commit comments

Comments
 (0)