summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-10-14 00:19:22 (GMT)
committerGitHub <noreply@github.com>2018-10-14 00:19:22 (GMT)
commit77e0abe228564a5be23284bd8e963c11952eb55b (patch)
treed7763a463a718d6d80bc6067d0a6268b24af2494 /Lib/idlelib
parent6a1238cb44da5b4610fde6cbcbd15e2ad7340c99 (diff)
downloadcpython-77e0abe228564a5be23284bd8e963c11952eb55b.zip
cpython-77e0abe228564a5be23284bd8e963c11952eb55b.tar.gz
cpython-77e0abe228564a5be23284bd8e963c11952eb55b.tar.bz2
bpo-33656: Move pyshell ctypes import inside try block. (GH-9858)
A Windows build with _tkinter, tkinter, and idlelib but without ctypes is unlikely but apparently possible. (cherry picked from commit d274afb5e579a5d9d990f68f9af856cf4c918779) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib')
-rwxr-xr-xLib/idlelib/pyshell.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index 5458c59..47eef43 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -12,11 +12,11 @@ except ImportError:
# Valid arguments for the ...Awareness call below are defined in the following.
# https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
if sys.platform == 'win32':
- import ctypes
- PROCESS_SYSTEM_DPI_AWARE = 1
try:
+ import ctypes
+ PROCESS_SYSTEM_DPI_AWARE = 1
ctypes.OleDLL('shcore').SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE)
- except (AttributeError, OSError):
+ except (ImportError, AttributeError, OSError):
pass
import tkinter.messagebox as tkMessageBox