DEPRECATED since IPython 5.0 Set PyOS_InputHook to callback and return the previous one.
(self, callback)
| 146 | return self.PYFUNC.in_dll(ctypes.pythonapi,"PyOS_InputHook") |
| 147 | |
| 148 | def set_inputhook(self, callback): |
| 149 | """DEPRECATED since IPython 5.0 |
| 150 | |
| 151 | Set PyOS_InputHook to callback and return the previous one.""" |
| 152 | # On platforms with 'readline' support, it's all too likely to |
| 153 | # have a KeyboardInterrupt signal delivered *even before* an |
| 154 | # initial ``try:`` clause in the callback can be executed, so |
| 155 | # we need to disable CTRL+C in this situation. |
| 156 | ignore_CTRL_C() |
| 157 | self._callback = callback |
| 158 | self._callback_pyfunctype = self.PYFUNC(callback) |
| 159 | pyos_inputhook_ptr = self.get_pyos_inputhook() |
| 160 | original = self.get_pyos_inputhook_as_func() |
| 161 | pyos_inputhook_ptr.value = \ |
| 162 | ctypes.cast(self._callback_pyfunctype, ctypes.c_void_p).value |
| 163 | self._installed = True |
| 164 | return original |
| 165 | |
| 166 | def clear_inputhook(self, app=None): |
| 167 | """DEPRECATED since IPython 5.0 |