Index: /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp
===================================================================
--- /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp	(revision 39718)
+++ /trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp	(revision 39719)
@@ -514,14 +514,10 @@
 #  include <iprt/err.h>
 
-static PyObject*
+static PyObject *
 PyXPCOMMethod_WaitForEvents(PyObject *self, PyObject *args)
 {
-    PRInt32 aTimeout;
-
-    if (!PyArg_ParseTuple(args, "i", &aTimeout))
-    {
-        PyErr_SetString(PyExc_TypeError, "the timeout argument is not an integer");
+    long lTimeout;
+    if (!PyArg_ParseTuple(args, "l", &lTimeout))
         return NULL;
-    }
 
     int rc;
@@ -535,5 +531,10 @@
 
     Py_BEGIN_ALLOW_THREADS
-    rc = aEventQ->processEventQueue(aTimeout < 0 ? RT_INDEFINITE_WAIT : (uint32_t)aTimeout);
+
+    RTMSINTERVAL cMsTimeout = (RTMSINTERVAL)lTimeout;
+    if (lTimeout < 0 || (long)cMsTimeout != lTimeout)
+        cMsTimeout = RT_INDEFINITE_WAIT;
+    rc = aEventQ->processEventQueue(cMsTimeout);
+
     Py_END_ALLOW_THREADS
     if (RT_SUCCESS(rc))
