pytevent improvements & Python 3 port

Petr Viktorin pviktori at redhat.com
Tue Jun 2 07:14:39 MDT 2015


On 05/26/2015 02:07 PM, Petr Viktorin wrote:
> Hello,
> 
> The first patch is a fix for a bug in the buildsystem changes for py3.
> (It only occurs when building for two Pythons, so Samba is safe.)
> 
> I've played a bit with the pytevent wrapper, and found that the types
> for timers and FDs are not defined, so, for example, trying to print
> them out segfaults:
> 
>     >>> import tevent
>     >>> ctx = tevent.Context()
>     >>> timer = ctx.add_timer(0, lambda t: None)
>     >>> timer
>     Segmentation fault (core dumped)
> 
> I'm sending a quick fix for FDs, and a more comprehensive one for timers.
> 
> Also, "Context.add_timer" requires passing a struct timeval cast to a
> long inside a Python integer, which is very hard to do portably from
> Python. I've added "add_timer_offset", which takes a number of seconds
> from now.
> 
> I've also ported pytevent to Python 3. The library doesn't deal with
> strings much, so the port is trivial.

Ping, could someone find the time to look at these patches?


-- 
Petr Viktorin


More information about the samba-technical mailing list