diff --git a/tests/test_pointers.py b/tests/test_pointers.py index 5e526b06..cb59b67f 100644 --- a/tests/test_pointers.py +++ b/tests/test_pointers.py @@ -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) diff --git a/uvloop/includes/uv.pxd b/uvloop/includes/uv.pxd index 2f2f1e80..595ff899 100644 --- a/uvloop/includes/uv.pxd +++ b/uvloop/includes/uv.pxd @@ -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() diff --git a/uvloop/loop.pyx b/uvloop/loop.pyx index ad6657a4..ce04a2ed 100644 --- a/uvloop/loop.pyx +++ b/uvloop/loop.pyx @@ -3230,6 +3230,9 @@ cdef class Loop: def get_uv_loop_t_ptr(self): return PyCapsule_New(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,