Support libuv < v1.9.0

This commit is contained in:
Yury Selivanov 2016-05-11 11:50:53 -04:00
parent 2e8947fc25
commit 6726a50b1a
4 changed files with 16 additions and 4 deletions

View File

@ -1,6 +1,6 @@
recursive-include examples *.py
recursive-include tests *.py *.pem
recursive-include uvloop *.pyx *.pxd *.pxi *.py
recursive-include uvloop *.pyx *.pxd *.pxi *.py *.c *.h
recursive-include vendor/libuv *
recursive-exclude vendor/libuv/.git *
recursive-exclude vendor/libuv/docs *

7
uvloop/includes/compat.h Normal file
View File

@ -0,0 +1,7 @@
#include "uv.h"
// uv_poll_event.UV_DISCONNECT is available since libuv v1.9.0
#if UV_VERSION_HEX < 0x10900
#define UV_DISCONNECT 0
#endif

View File

@ -4,6 +4,12 @@ from posix.types cimport gid_t, uid_t
from . cimport system
cdef extern from "includes/compat.h":
# Member of uv_poll_event, in compat.h for compatibility
# with libuv < v1.9.0
cdef int UV_DISCONNECT
cdef extern from "uv.h" nogil:
cdef int UV_EACCES
cdef int UV_EAGAIN
@ -183,8 +189,8 @@ cdef extern from "uv.h" nogil:
ctypedef enum uv_poll_event:
UV_READABLE = 1,
UV_WRITABLE = 2,
UV_DISCONNECT = 4
UV_WRITABLE = 2
# UV_DISCONNECT = 4 ; see compat.h for details
ctypedef enum uv_udp_flags:
UV_UDP_IPV6ONLY = 1,

View File

@ -43,7 +43,6 @@ cdef Loop __main_loop__ = None
cdef class Loop:
def __cinit__(self):
cdef int err
# Install PyMem* memory allocators if they aren't installed yet.
__install_pymem()