Commit Graph

5 Commits

Author SHA1 Message Date
Yury Selivanov 9f82bd7444
Port uvloop to Python 3.12 (#570)
* Bump Cython to 0.29.36
* Add missing new API -- timeout param to shutdown_default_executor
* Stop using the beloved, but now deprecated, 'IF'
* Explicitly qualify void-returning callback functions as `noexcept`.
* Fix test_libuv_get_loop_t_ptr to work under Python 3.12
* "Fix" the failing asyncio tests by adding a sleep() call
* Add 3.12 to CI scripts
* Stop configuring watchers for asyncio tests under 3.12+
* Add the new timeout parameter of shutdown_default_executor to typeshed
* Implement uvloop.run()
* Add pyproject.toml and update CI

Co-authored-by: Fantix King <fantix.king@gmail.com>
2023-10-09 19:28:47 -05:00
Yury Selivanov c32c7039cd Fix KeyboardInterrupt handling logic.
When uvloop is run in the main thread we *always* want to set up a
self-pipe and a signal wakeup FD.  That's the only way how libuv
can be notified that a ^C happened and break away from selecting
on sockets.

asyncio does not need to do that, as the 'selectors' module it uses
is already aware of the way Python implements ^C handling.

This translates to a slightly different behavior between asyncio &
uvloop:

1. uvloop needs to always call signal.set_wakeup_fd() when run in the
  main thread;

2. asyncio only needs to call signal.set_wakeup_fd() when a user
  registers a signal handler.

(2) means that if the user had not set up any signals, the signal
wakeup FD stays the same between different asyncio runs.  This commit
fixes uvloop signal implementation to make sure that uvloop behaves
the same way as asyncio in regards to signal wakeup FD between the
loop runs.  It also ensures that uvloop always have a proper
self-pipe set up so that ^C is always supported when it is run in
the main thread.

Issue #295.
2019-10-28 22:53:26 -04:00
Yury Selivanov eb8d7ba170 tests: Stop passing loop explicitly in tests
In 3.8 a lot of asyncio functions have their `loop` parameter
deprecated.  So we change the semantics of uvloop tests to never
pass the loop explicitly (unless to Future objects, when necessary)

That means that we now also need to set up asyncio/uvloop loop policies
for tests in setUp hooks.
2019-10-24 14:42:54 -04:00
Yury Selivanov 92526cfdcb Make subprocess tests resilient to warnings 2018-08-01 21:13:20 -04:00
Yury Selivanov f33c4f4548 Fix unhandled errors in Handle.__dealloc__ producing unwanted stderr output 2017-11-16 17:56:23 -05:00