Skip to content

Commit

Permalink
bpo-33656: Move pyshell ctypes import inside try block. (GH-9858)
Browse files Browse the repository at this point in the history
A Windows build with _tkinter, tkinter, and idlelib
but without ctypes is unlikely but apparently possible.
(cherry picked from commit d274afb)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
  • Loading branch information
miss-islington and terryjreedy committed Oct 14, 2018
1 parent 6a1238c commit 77e0abe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lib/idlelib/pyshell.py
Expand Up @@ -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
Expand Down

0 comments on commit 77e0abe

Please sign in to comment.