diff --git a/MANIFEST.in b/MANIFEST.in index f49cefd..c12aad3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 * diff --git a/uvloop/includes/compat.h b/uvloop/includes/compat.h new file mode 100644 index 0000000..917a56b --- /dev/null +++ b/uvloop/includes/compat.h @@ -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 diff --git a/uvloop/includes/uv.pxd b/uvloop/includes/uv.pxd index 3db699c..ee87a25 100644 --- a/uvloop/includes/uv.pxd +++ b/uvloop/includes/uv.pxd @@ -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, diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index 81f2a3e..8973df4 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -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()