Commit Graph

18 Commits

Author SHA1 Message Date
Fantix King ee5ad26a75
Drop support of Python 3.7 and update CI (#578)
* Drop support of Python 3.7
* Upgrade and pin action revisions in CI
* Exclude C files in wheel dist
2023-10-22 13:04:03 -05:00
horpto e7934c8820
Fix incorrect main thread id value forking from a thread (#453)
* Fix incorrect main thread id value in mp.Process
* Make MAIN_THREAD_ID a lazy value and add test

Co-authored-by: Александр Менщиков <menshchikov@zvonok.com>
Co-authored-by: Fantix King <fantix.king@gmail.com>
2022-08-31 15:59:31 -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 006805091c
Drop explicit `loop=` argument from test_wakeup_fd_unchanged 2019-10-25 00:10:59 -04:00
Vladimir Matveev 48d376d30c Keep behavior of run_* consistent with event loops bundled in CPython: ensure that wakeup fd is non-modified if it was not changed before i.e. via calling add_signal_handler 2019-10-24 14:58:29 -04:00
Yury Selivanov 5f48dab8fa tests: Support 3.8 2019-10-24 14:42:54 -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 b8fb1ef1d0 Enforce consistent code style with flake8 2019-02-16 09:18:25 -05:00
Yury Selivanov 92526cfdcb Make subprocess tests resilient to warnings 2018-08-01 21:13:20 -04:00
Yury Selivanov cd53b7f559
Prohibit adding a signal handler for SIGCHLD (#156) 2018-05-25 17:35:05 -04:00
claws f894ac7403 Fix code style in unittest 2016-05-07 11:05:33 -04:00
Yury Selivanov d350f916fb Fix add_signal_handler to raise the same exc asyncio raises for inv signal 2016-05-05 22:08:20 -04:00
Yury Selivanov cc10f73bf3 tests: Another attempt to fix test_signals_restore on Travis 2016-04-19 12:18:54 -04:00
Yury Selivanov e7202088a3 tests/signals: Silence resource warnings in subprocesses 2016-04-19 10:39:28 -04:00
Yury Selivanov 97a64505d1 signals: Use 'sigaction' syscall for setting up signal handlers 2016-04-18 17:54:11 -04:00
Yury Selivanov ee0ccd4156 signals: Use PyErr_SetInterrupt directly to interrupt running py code 2016-04-16 19:13:13 -04:00
Andrew Svetlov eb80fc16c2 Introduce uvloop.new_event_loop() (#5) 2016-04-12 13:52:52 -04:00
Yury Selivanov 5457d1eda3 Implement loop.{add|remove}_signal_handler. 2016-04-11 21:53:20 -04:00