All pastes #987388 Raw Edit

sophacles

public text v1 · immutable
·published 2008-04-16 14:17 UTC
rendered paste body
ORIGINAL CODE:
Function declaration is:

    def add(self, float timeout=-1):

The complaint is in (line starting with self.tv.tv_usec), which is also the first time timeout is used in the function:

        if timeout >= 0.0:
            self.tv.tv_sec = <long>timeout
            self.tv.tv_usec = (timeout - <float>self.tv.tv_sec) * 1000000.0
            event_add(&self.ev, &self.tv)

ERROR OUTPUT:
/root/pyevent/pyevent-0.3/event2.pyx:156:64: Cannot assign type 'double' to 'unsigned int'

I fixed it by changing the complaining line to:

self.tv.tv_usec = (timeout - float(self.tv.tv_sec))