Skip to content

Commit 6726a50

Browse files
committed
Support libuv < v1.9.0
1 parent 2e8947f commit 6726a50

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
recursive-include examples *.py
22
recursive-include tests *.py *.pem
3-
recursive-include uvloop *.pyx *.pxd *.pxi *.py
3+
recursive-include uvloop *.pyx *.pxd *.pxi *.py *.c *.h
44
recursive-include vendor/libuv *
55
recursive-exclude vendor/libuv/.git *
66
recursive-exclude vendor/libuv/docs *

uvloop/includes/compat.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "uv.h"
2+
3+
4+
// uv_poll_event.UV_DISCONNECT is available since libuv v1.9.0
5+
#if UV_VERSION_HEX < 0x10900
6+
#define UV_DISCONNECT 0
7+
#endif

uvloop/includes/uv.pxd

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ from posix.types cimport gid_t, uid_t
44
from . cimport system
55

66

7+
cdef extern from "includes/compat.h":
8+
# Member of uv_poll_event, in compat.h for compatibility
9+
# with libuv < v1.9.0
10+
cdef int UV_DISCONNECT
11+
12+
713
cdef extern from "uv.h" nogil:
814
cdef int UV_EACCES
915
cdef int UV_EAGAIN
@@ -183,8 +189,8 @@ cdef extern from "uv.h" nogil:
183189

184190
ctypedef enum uv_poll_event:
185191
UV_READABLE = 1,
186-
UV_WRITABLE = 2,
187-
UV_DISCONNECT = 4
192+
UV_WRITABLE = 2
193+
# UV_DISCONNECT = 4 ; see compat.h for details
188194

189195
ctypedef enum uv_udp_flags:
190196
UV_UDP_IPV6ONLY = 1,

uvloop/loop.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ cdef Loop __main_loop__ = None
4343
cdef class Loop:
4444
def __cinit__(self):
4545
cdef int err
46-
4746
# Install PyMem* memory allocators if they aren't installed yet.
4847
__install_pymem()
4948

0 commit comments

Comments
 (0)