##// END OF EJS Templates
Merging bug fix from keyboardint64 branch.
Brian Granger -
r1932:8a6da14b merge
parent child Browse files
Show More
@@ -292,17 +292,19 b' if HAS_CTYPES:'
292 """raises the exception, performs cleanup if needed"""
292 """raises the exception, performs cleanup if needed"""
293 if not inspect.isclass(exctype):
293 if not inspect.isclass(exctype):
294 raise TypeError("Only types can be raised (not instances)")
294 raise TypeError("Only types can be raised (not instances)")
295 res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid,
295 # Explicit cast to c_long is necessary for 64-bit support:
296 # See https://bugs.launchpad.net/ipython/+bug/237073
297 res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid),
296 ctypes.py_object(exctype))
298 ctypes.py_object(exctype))
297 if res == 0:
299 if res == 0:
298 raise ValueError("invalid thread id")
300 raise ValueError("invalid thread id")
299 elif res != 1:
301 elif res != 1:
300 # """if it returns a number greater than one, you're in trouble,
302 # If it returns a number greater than one, you're in trouble,
301 # and you should call it again with exc=NULL to revert the effect"""
303 # and you should call it again with exc=NULL to revert the effect
302 ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, 0)
304 ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, 0)
303 raise SystemError("PyThreadState_SetAsyncExc failed")
305 raise SystemError("PyThreadState_SetAsyncExc failed")
304
306
305 def sigint_handler (signum,stack_frame):
307 def sigint_handler(signum,stack_frame):
306 """Sigint handler for threaded apps.
308 """Sigint handler for threaded apps.
307
309
308 This is a horrible hack to pass information about SIGINT _without_
310 This is a horrible hack to pass information about SIGINT _without_
@@ -321,7 +323,7 b' if HAS_CTYPES:'
321 Term.cout.flush()
323 Term.cout.flush()
322
324
323 else:
325 else:
324 def sigint_handler (signum,stack_frame):
326 def sigint_handler(signum,stack_frame):
325 """Sigint handler for threaded apps.
327 """Sigint handler for threaded apps.
326
328
327 This is a horrible hack to pass information about SIGINT _without_
329 This is a horrible hack to pass information about SIGINT _without_
General Comments 0
You need to be logged in to leave comments. Login now