Skip to content

Commit

Permalink
Support libuv < v1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 committed May 11, 2016
1 parent 2e8947f commit 6726a50
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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 *
Expand Down
7 changes: 7 additions & 0 deletions uvloop/includes/compat.h
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions uvloop/includes/uv.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 6726a50

Please sign in to comment.