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 d274afb5e5)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
Miss Islington (bot) 2018-10-13 17:19:22 -07:00 committed by GitHub
parent 6a1238cb44
commit 77e0abe228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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