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 99f7b0f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ 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):
from uvloop.loop import get_uv_version
self.assertGreater(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()
4 changes: 4 additions & 0 deletions uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3231,6 +3231,10 @@ cdef class Loop:
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,
uv.uv_buf_t* buf) with gil:
Expand Down

0 comments on commit 99f7b0f

Please sign in to comment.