home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import inspect
- import thread
-
- try:
- import ctypes
- HAS_CTYPES = True
- except ImportError:
- HAS_CTYPES = False
-
- from IPython.genutils import Term, warn, error, flag_calls, ask_yes_no
- KBINT = False
- USE_TK = False
- MAIN_THREAD_ID = thread.get_ident()
- CODE_RUN = None
- if HAS_CTYPES:
-
- def _async_raise(tid, exctype):
- if not inspect.isclass(exctype):
- raise TypeError('Only types can be raised (not instances)')
- inspect.isclass(exctype)
- res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype))
- if res == 0:
- raise ValueError('invalid thread id')
- res == 0
- if res != 1:
- ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, 0)
- raise SystemError('PyThreadState_SetAsyncExc failed')
- res != 1
-
-
- def sigint_handler(signum, stack_frame):
- global KBINT
- if CODE_RUN:
- _async_raise(MAIN_THREAD_ID, KeyboardInterrupt)
- else:
- KBINT = True
- print '\nKeyboardInterrupt - Press <Enter> to continue.',
- Term.cout.flush()
-
- else:
-
- def sigint_handler(signum, stack_frame):
- global KBINT
- print '\nKeyboardInterrupt - Press <Enter> to continue.',
- Term.cout.flush()
- KBINT = True
-
-
- def run_in_frontend(src):
- if src.startswith('_ip.system(') and '\n' not in src:
- return True
- return False
-
-