From 8ace845f044d70f235a2141aec34ad6ab20accb0 2009-04-14 20:08:12 From: Brian Granger Date: 2009-04-14 20:08:12 Subject: [PATCH] Fix for ticket 237073 thanks to Nathaniel Smith A value passed to PyThreadState_SetAsyncExc needs to be a c_long on 64 bit platforms. --- diff --git a/IPython/Shell.py b/IPython/Shell.py index 5454f7b..5fdab89 100644 --- a/IPython/Shell.py +++ b/IPython/Shell.py @@ -292,7 +292,9 @@ if HAS_CTYPES: """raises the exception, performs cleanup if needed""" if not inspect.isclass(exctype): raise TypeError("Only types can be raised (not instances)") - res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, + # Explicit cast to c_long is necessary for 64-bit support: + # See https://bugs.launchpad.net/ipython/+bug/237073 + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), ctypes.py_object(exctype)) if res == 0: raise ValueError("invalid thread id")