[Python-checkins] bpo-33656: Move pyshell ctypes import inside try block. (GH-9858)
Miss Islington (bot)
webhook-mailer at python.org
Sat Oct 13 20:19:26 EDT 2018
https://github.com/python/cpython/commit/77e0abe228564a5be23284bd8e963c11952eb55b
commit: 77e0abe228564a5be23284bd8e963c11952eb55b
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-13T17:19:22-07:00
summary:
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 at udel.edu>
files:
M Lib/idlelib/pyshell.py
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index 5458c59dbd7e..47eef4399ce6 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -12,11 +12,11 @@
# 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
More information about the Python-checkins
mailing list