Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14c1fae

Browse files
committed
Merge pull request #8430 from Lucretiel/patch-1
register now checks for missing ctypes
2 parents d707982 + 04c5d35 commit 14c1fae

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

IPython/lib/inputhook.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class InputHookManager(object):
107107
def __init__(self):
108108
if ctypes is None:
109109
warn("IPython GUI event loop requires ctypes, %gui will not be available")
110-
return
111-
self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int)
110+
else:
111+
self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int)
112112
self.guihooks = {}
113113
self.aliases = {}
114114
self.apps = {}
@@ -197,10 +197,11 @@ def enable(self, app=None):
197197
...
198198
"""
199199
def decorator(cls):
200-
inst = cls(self)
201-
self.guihooks[toolkitname] = inst
202-
for a in aliases:
203-
self.aliases[a] = toolkitname
200+
if ctypes is not None:
201+
inst = cls(self)
202+
self.guihooks[toolkitname] = inst
203+
for a in aliases:
204+
self.aliases[a] = toolkitname
204205
return cls
205206
return decorator
206207

0 commit comments

Comments
 (0)