summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/base_events.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-113538: Add asycio.Server.{close,abort}_clients (redo) (#116784)Pierre Ossman (ThinLinc team)2024-03-181-8/+17
| | | | | | | These give applications the option of more forcefully terminating client connections for asyncio servers. Useful when terminating a service and there is limited time to wait for clients to finish up their work. This is a do-over with a test fix for gh-114432, which was reverted.
* gh-113538: Revert "gh-113538: Add asycio.Server.{close,abort}_clients ↵Guido van Rossum2024-03-121-17/+8
| | | | | | | | | | (#114432)" (#116632) Revert "gh-113538: Add asycio.Server.{close,abort}_clients (#114432)" Reason: The new test doesn't always pass: https://github.com/python/cpython/pull/116423#issuecomment-1989425489 This reverts commit 1d0d49a7e86257ff95b4de0685e6997d7533993c.
* gh-113538: Add asycio.Server.{close,abort}_clients (#114432)Pierre Ossman (ThinLinc team)2024-03-111-8/+17
| | | | | | These give applications the option of more forcefully terminating client connections for asyncio servers. Useful when terminating a service and there is limited time to wait for clients to finish up their work.
* gh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor ↵Jamie Phan2024-02-191-9/+11
| | | | (#115622)
* gh-114887 Reject only sockets of type SOCK_STREAM in ↵Travis Howse2024-02-031-2/+2
| | | | | | | create_datagram_endpoint() (#114893) Also improve exception message. Co-authored-by: Donghee Na <donghee.na92@gmail.com>
* gh-75128: Ignore EADDRNOTAVAIL error in ↵Serhiy Storchaka2024-01-221-3/+17
| | | | | asyncio.BaseEventLoop.create_server() (GH-114420) Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* gh-101336: Add keep_alive keyword arg for asyncio create_server() (#112485)beavailable2023-12-131-0/+4
|
* gh-79033: Try to fix asyncio.Server.wait_closed() again (GH-111336)Guido van Rossum2023-10-281-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Try to fix asyncio.Server.wait_closed() again I identified the condition that `wait_closed()` is intended to wait for: the server is closed *and* there are no more active connections. When this condition first becomes true, `_wakeup()` is called (either from `close()` or from `_detach()`) and it sets `_waiters` to `None`. So we just check for `self._waiters is None`; if it's not `None`, we know we have to wait, and do so. A problem was that the new test introduced in 3.12 explicitly tested that `wait_closed()` returns immediately when the server is *not* closed but there are currently no active connections. This was a mistake (probably a misunderstanding of the intended semantics). I've fixed the test, and added a separate test that checks exactly for this scenario. I also fixed an oddity where in `_wakeup()` the result of the waiter was set to the waiter itself. This result is not used anywhere and I changed this to `None`, to avoid a GC cycle. * Update Lib/asyncio/base_events.py --------- Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
* gh-110771: Decompose run_forever() into parts (#110773)Russell Keith-Magee2023-10-131-13/+38
| | | Effectively introduce an unstable, private (really: protected) API for subclasses that want to override `run_forever()`.
* gh-110733: Micro-optimization in BaseEventLoop._run_once (#110735)J. Nick Koston2023-10-111-2/+5
|
* gh-106634: Corrected minor asyncio doc issues (#106671)Chris Brett2023-07-131-1/+1
|
* GH-105684: Require `asyncio.Task` implementations to support `set_name` ↵Kumar Aditya2023-06-131-1/+1
| | | | method (#105685)
* gh-101143: Remove references to `TimerHandle` from ↵J. Nick Koston2023-01-211-6/+3
| | | | | `asyncio.base_events.BaseEventLoop._add_callback` (#101197) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-86508: skip binding to local addresses of different family in ↵Kumar Aditya2023-01-041-2/+8
| | | | `asyncio.open_connection` (#100615)
* GH-79033: Fix asyncio.Server.wait_closed() (#98582)Guido van Rossum2022-11-241-1/+1
| | | | | | | | | | | It was a no-op when used as recommended (after close()). I had to debug one test (test__sock_sendfile_native_failure) -- the cleanup sequence for the test fixture was botched. Hopefully that's not a portend of problems in user code -- this has never worked so people may well be doing this wrong. :-( Co-authored-by: kumar aditya
* gh-88863: Clear ref cycles to resolve leak when asyncio.open_connection ↵Dong Uk, Kang2022-11-221-12/+19
| | | | | | | raises (#95739) Break reference cycles to resolve memory leak, by removing local exception and future instances from the frame
* GH-96704: Add {Task,Handle}.get_context(), use it in ↵Guido van Rossum2022-10-051-1/+16
| | | | | call_exception_handler() (#96756) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-94732: Fix KeyboardInterrupt race in asyncio run_forever() (#97765)hetmankp2022-10-031-3/+4
| | | Ensure that the event loop's `_thread_id` attribute and the asyncgen hooks set by `sys.set_asyncgen_hooks()` are always restored no matter where a KeyboardInterrupt exception is raised.
* GH-96827: Don't touch closed loops from executor threads (#96837)Guido van Rossum2022-09-301-2/+4
| | | | | * When chaining futures, skip callback if loop closed. * When shutting down an executor, don't wake a closed loop.
* GH-82448: Add thread timeout for loop.shutdown_default_executor (#97561)Kumar Aditya2022-09-281-3/+14
| | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* gh-93973: Add all_errors to asyncio.create_connection (#93974)Pamela Fox2022-09-051-1/+4
| | | | Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
* Fix missing `f` prefix on f-strings (GH-91910)Alexander Shadchin2022-04-271-1/+1
|
* bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API ↵Andrew Svetlov2022-03-141-3/+8
| | | | (GH-31837)
* bpo-46955: Expose asyncio.base_events.Server as asyncio.Server (GH-31760)Stefan Zabka2022-03-081-1/+1
| | | | | | This change aligns the documentation at https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.Server with the actual implementation Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* Raise TypeError if SSLSocket is passed to asyncio transport-based methods ↵Andrew Svetlov2022-02-201-0/+15
| | | | (GH-31442)
* bpo-44011: New asyncio ssl implementation (#31275)Kumar Aditya2022-02-151-9/+34
| | | | | | | | | | | * bpo-44011: New asyncio ssl implementation Co-Authored-By: Andrew Svetlov <andrew.svetlov@gmail.com> * fix warning * fix typo Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-23819: Fix asyncio tests on python optimized mode (GH-30195)Kumar Aditya2021-12-261-2/+2
|
* Re-add `reuse_address` parameter to `create_server` (GH-29733)Jim Crist-Harif2021-12-121-0/+6
| | | | | | | This parameter was accidentally removed when fixing https://bugs.python.org/issue45129, this reverts the unnecessary changes there. Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-23819: asyncio: Replace AssertionError with TypeError where it makes ↵Kumar Aditya2021-12-061-0/+4
| | | | sense (GH-29894)
* bpo-45129 Remove deprecated reuse_address (GH-28207)Hugo van Kemenade2021-09-081-25/+2
| | | | | | | | Due to significant security concerns, the reuse_address parameter of asyncio.loop.create_datagram_endpoint, deprecated in Python 3.9, is now removed. This is because of the behavior of the socket option SO_REUSEADDR in UDP. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-44740: Lowercase "internet" and "web" where appropriate. (#27378)Mariusz Felisiak2021-07-261-1/+1
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* bpo-43234: Prohibit non-ThreadPoolExecutor in loop.set_default_executor ↵Illia Volochii2021-07-011-5/+1
| | | | (GH-24540)
* bpo-44011: Revert "New asyncio ssl implementation (GH-17975)" (GH-25848)Pablo Galindo2021-05-031-34/+9
| | | | This reverts commit 5fb06edbbb769561e245d0fe13002bab50e2ae60 and all subsequent dependent commits.
* bpo-44011: New asyncio ssl implementation (#17975)Andrew Svetlov2021-05-021-9/+34
|
* bpo-42392: Remove loop parameter from asyncio.tasks and asyncio.subprocess ↵Yurii Karabas2020-11-281-5/+4
| | | | (GH-23521)
* bpo-41332: Added missing connect_accepted_socket() to AbstractEventLoop ↵Alex Grönholm2020-11-261-8/+0
| | | | | | (GH-21533) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com> Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* bpo-39609: set the thread_name_prefix for the default asyncio executor ↵Markus Mohrhard2020-02-271-1/+3
| | | | | (GH-18458) Just a small debugging improvement to identify the asyncio executor threads.
* bpo-39191: Fix RuntimeWarning in asyncio test (GH-17863)Andrew Svetlov2020-01-071-3/+3
| | | https://bugs.python.org/issue39191
* Fix #39191: Don't spawn a task before failing (#17796)Andrew Svetlov2020-01-041-3/+7
|
* bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR (#17311)Kyle Stanley2019-12-091-7/+18
|
* bpo-34037: Fix test_asyncio failure and add loop.shutdown_default_executor() ↵Kyle Stanley2019-09-191-0/+29
| | | | (GH-15735)
* Use threadpool for reading from file in sendfile fallback mode (#14076)Andrew Svetlov2019-06-151-1/+1
|
* bpo-37279: Fix asyncio sendfile support when extra data are sent in ↵Andrew Svetlov2019-06-151-2/+2
| | | | fallback mode. (GH-14075)
* Revert "bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close ↵Łukasz Langa2019-06-041-3/+1
| | | | | (GH-13786)" (#13802) This reverts commit 0f0a30f4da4b529e0f7df857b9f575b231b32758.
* bpo-34037, asyncio: add BaseEventLoop.wait_executor_on_close (GH-13786)Victor Stinner2019-06-031-1/+3
| | | | | | | Add BaseEventLoop.wait_executor_on_close attribute: true by default. loop.close() now waits for the default executor to finish by default. Set loop.wait_executor_on_close attribute to False to not wait for the executor.
* bpo-35246: fix support for path-like args in asyncio subprocess (GH-13628)依云2019-05-291-5/+0
| | | | | | | | | Drop isinstance checks from create_subprocess_exec function and let subprocess module do them. https://bugs.python.org/issue35246 https://bugs.python.org/issue35246
* bpo-36686: Improve the documentation of the std* params in ↵sbstp2019-05-271-1/+18
| | | | | loop.subprocess_exec (GH-13586) https://bugs.python.org/issue36686
* bpo-37027: Return a proxy socket object from transp.get_extra_info('socket') ↵Yury Selivanov2019-05-271-2/+3
| | | | | | | | | | (GH-13530) Return a safe to use proxy socket object from `transport.get_extra_info('socket')` https://bugs.python.org/issue37027
* bpo-37035: Don't log OSError (GH-13548)Andrew Svetlov2019-05-271-7/+0
| | | https://bugs.python.org/issue37035
* bpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)Yury Selivanov2019-05-271-5/+11
| | | | | | | | | | | | | | | This will address the common mistake many asyncio users make: an "except Exception" clause breaking Tasks cancellation. In addition to this change, we stop inheriting asyncio.TimeoutError and asyncio.InvalidStateError from their concurrent.futures.* counterparts. There's no point for these exceptions to share the inheritance chain. In 3.9 we'll focus on implementing supervisors and cancel scopes, which should allow better handling of all exceptions, including SystemExit and KeyboardInterrupt