File tree Expand file tree Collapse file tree 4 files changed +32
-21
lines changed Expand file tree Collapse file tree 4 files changed +32
-21
lines changed Original file line number Diff line number Diff line change 1+ from uvloop import _testbase as tb
2+ from uvloop .loop import libuv_get_loop_t_ptr , libuv_get_version
3+
4+
5+ class Test_UV_libuv (tb .UVTestCase ):
6+ def test_libuv_get_loop_t_ptr (self ):
7+ loop = self .new_loop ()
8+ cap1 = libuv_get_loop_t_ptr (loop )
9+ cap2 = libuv_get_loop_t_ptr (loop )
10+ cap3 = libuv_get_loop_t_ptr (self .new_loop ())
11+
12+ import pyximport
13+
14+ pyximport .install ()
15+
16+ from tests import cython_helper
17+
18+ self .assertTrue (cython_helper .capsule_equals (cap1 , cap2 ))
19+ self .assertFalse (cython_helper .capsule_equals (cap1 , cap3 ))
20+
21+ def test_libuv_get_version (self ):
22+ self .assertGreater (libuv_get_version (), 0 )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -501,3 +501,5 @@ cdef extern from "uv.h" nogil:
501501 const uv_process_options_t* options)
502502
503503 int uv_process_kill(uv_process_t* handle, int signum)
504+
505+ unsigned int uv_version()
Original file line number Diff line number Diff line change @@ -3226,9 +3226,14 @@ cdef class Loop:
32263226 except Exception as ex:
32273227 self .call_soon_threadsafe(future.set_exception, ex)
32283228
3229- # Expose pointer for integration with other C-extensions
3230- def get_uv_loop_t_ptr (self ):
3231- return PyCapsule_New(< void * > self .uvloop, NULL , NULL )
3229+
3230+ # Expose pointer for integration with other C-extensions
3231+ def libuv_get_loop_t_ptr (loop ):
3232+ return PyCapsule_New(< void * > (< Loop> loop).uvloop, NULL , NULL )
3233+
3234+
3235+ def libuv_get_version ():
3236+ return uv.uv_version()
32323237
32333238
32343239cdef void __loop_alloc_buffer(uv.uv_handle_t* uvhandle,
You can’t perform that action at this time.
0 commit comments