Skip to content

Commit

Permalink
Expose uv_version() for libuv API compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Sep 9, 2022
1 parent 74d381e commit dbd849a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ def test_get_uv_loop_t_ptr(self):

self.assertTrue(cython_helper.capsule_equals(cap1, cap2))
self.assertFalse(cython_helper.capsule_equals(cap1, cap3))

def test_get_uv_version(self):
self.assertGreater(self.loop.get_uv_version(), 0)
2 changes: 2 additions & 0 deletions uvloop/includes/uv.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -501,3 +501,5 @@ cdef extern from "uv.h" nogil:
const uv_process_options_t* options)

int uv_process_kill(uv_process_t* handle, int signum)

unsigned int uv_version()
3 changes: 3 additions & 0 deletions uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3230,6 +3230,9 @@ cdef class Loop:
def get_uv_loop_t_ptr(self):
return PyCapsule_New(<void *>self.uvloop, NULL, NULL)

def get_uv_version(self):
return uv.uv_version()


cdef void __loop_alloc_buffer(uv.uv_handle_t* uvhandle,
size_t suggested_size,
Expand Down

0 comments on commit dbd849a

Please sign in to comment.