Commits

Ian Bicking committed 42446b6

Coerce thread id to a long, might fix problems in Ubuntu: http://trac.pythonpaste.org/pythonpaste/ticket/416

Comments (0)

Files changed (1)

paste/util/killthread.py

         raise TypeError("Only types can be raised (not instances)")
     if not isinstance(tid, int):
         raise TypeError("tid must be an integer")
-    res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype))
+    res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), ctypes.py_object(exctype))
     if res == 0:
         raise ValueError("invalid thread id")
     elif res != 1:
-        # """if it returns a number greater than one, you're in trouble, 
+        # """if it returns a number greater than one, you're in trouble,
         # and you should call it again with exc=NULL to revert the effect"""
-        ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, 0)
+        ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_long(tid), 0)
         raise SystemError("PyThreadState_SetAsyncExc failed")