Commit graph

1106 commits

Author SHA1 Message Date
maurycy
db8742e2b4
Remove redundant assignment in asyncio.streams.StreamReaderProtocol.connection_lost() (GH-137524)
The _stream_writer attribute was removed in a355f60 (gh-114914).
2025-08-07 18:38:14 +03:00
Daniele Parmeggiani
ee72c95aa9
gh-134861: Add 🍌SV output format to `python -m asyncio ps` (#137486)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-06 20:42:34 +00:00
Daniele Parmeggiani
470cbe97a5
gh-134861: Add CSV output format to `python -m asyncio ps` (#134862)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-06 20:10:40 +00:00
alexey semenyuk
c5cebe1b5a
gh-137128: Remove outdated todo about coro_fns in asyncio (#137385) 2025-08-04 16:44:29 +00:00
Serhiy Storchaka
1612dcbafe
gh-137341: Remove more word duplications (GH-137342) 2025-08-03 19:41:12 +03:00
Justin Bronder
e3ea861351
gh-135444: fix asyncio.DatagramTransport.sendto to account for datagram header size when data cannot be sent (#135445)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-30 23:41:28 +05:30
Raymond Hettinger
ea06ae5b5e
Fix Queue.shutdown docs for condition to unblock a join (gh-137088) 2025-07-25 07:56:28 -06:00
Raymond Hettinger
245671555b
Fix docs for Queue.shutdown (gh-137028) 2025-07-24 11:23:03 -06:00
Justin Su
77fa7a4dcc
gh-136447: Use self.loop instead of global loop variable in asyncio REPL (#136448) 2025-07-09 14:27:20 +05:30
Jelle Zijlstra
797abd1f7f
gh-134657: Remove newly added private names from asyncio.__all__ (#134665) 2025-07-09 13:25:46 +05:30
Serhiy Storchaka
9084b15156
gh-135836: Fix IndexError in asyncio.create_connection() (#135875) 2025-07-03 09:38:39 +05:30
heliang666s
0e19db653d
gh-135836: Fix IndexError in asyncio.create_connection with empty exceptions list (#135845)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-07-01 11:50:11 +00:00
Pablo Galindo Salgado
028309fb47
gh-135371: Fix asyncio introspection output to include internal coroutine chains (#135436) 2025-06-14 13:48:25 +01:00
Pablo Galindo Salgado
42b25ad4d3
gh-91048: Refactor and optimize remote debugging module (#134652)
Completely refactor Modules/_remote_debugging_module.c with improved
code organization, replacing scattered reference counting and error
handling with centralized goto error paths. This cleanup improves
maintainability and reduces code duplication throughout the module while
preserving the same external API.

Implement memory page caching optimization in Python/remote_debug.h to
avoid repeated reads of the same memory regions during debugging
operations. The cache stores previously read memory pages and reuses
them for subsequent reads, significantly reducing system calls and
improving performance.

Add code object caching mechanism with a new code_object_generation
field in the interpreter state that tracks when code object caches need
invalidation. This allows efficient reuse of parsed code object metadata
and eliminates redundant processing of the same code objects across
debugging sessions.

Optimize memory operations by replacing multiple individual structure
copies with single bulk reads for the same data structures. This reduces
the number of memory operations and system calls required to gather
debugging information from the target process.

Update Makefile.pre.in to include Python/remote_debug.h in the headers
list, ensuring that changes to the remote debugging header force proper
recompilation of dependent modules and maintain build consistency across
the codebase.

Also, make the module compatible with the free threading build as an extra :)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-25 20:19:29 +00:00
Evgeny Demchenko
f9324cb3cb
gh-134451: Converted asyncio.tools.CycleFoundException from dataclass to a regular exception type. (#134513) 2025-05-23 05:15:21 +00:00
Kumar Aditya
5804ee7b46
gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (#134508) 2025-05-23 10:03:16 +05:30
Christian Harries
109f7597d2
gh-90871: fix connection backlog offset in asyncio (gh-134392)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-21 15:59:09 +02:00
Christian Harries
f695eca60c
gh-86802: Fix asyncio memory leak; shielded task exceptions log once through the exception handler (gh-134331)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-05-20 17:14:27 +02:00
J. Nick Koston
53da1e8c8c
gh-134173: optimize state transfer between concurrent.futures.Future and asyncio.Future (#134174)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-05-18 21:26:20 +05:30
Sebastian Rittau
1d3eacedb8
gh-133893: asyncio.graph: Replace TextIO annotation with io.Writer (#133894) 2025-05-11 17:59:56 +03:00
Łukasz Langa
60cdd800d9
gh-91048: Add filename:line_no information to asyncio pstree (#133478) 2025-05-05 23:07:33 +00:00
Łukasz Langa
f610bbdf74
gh-133346: Make theming support in _colorize extensible (GH-133347)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-05 23:45:25 +02:00
Thomas Grainger
08d7687094
gh-128307: Support eager_start=<bool> in create_eager_task_factory and various create_task functions (#128306)
Some create_task() functions were changed from `name=None, context=None` to `**kwargs`.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2025-05-05 04:58:07 +00:00
Adam Turner
3f80165a26
GH-91048: Minor fixes for `_remotedebugging & rename to _remote_debugging` (#133398) 2025-05-05 02:30:14 +02:00
Pablo Galindo Salgado
3109c47be8
gh-91048: Add filename and line number to external inspection routines (GH-133385)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2025-05-04 23:33:37 +02:00
Pablo Galindo Salgado
2bc8365231
GH-91048: Add utils for printing the call stack for asyncio tasks (#133284) 2025-05-04 00:51:57 +00:00
Kumar Aditya
ce753517a8
gh-86513: improve docs of loop.call_exception_handler (#132466) 2025-04-13 21:39:24 +00:00
Kumar Aditya
05d27a84f4
gh-130322: drop deprecation of asyncio.set_event_loop (#132349) 2025-04-12 12:03:52 +05:30
Stan Ulbrych
a214db0c54
gh-132307: Remove unnecessary check in asyncio/base_events.py (#132324) 2025-04-10 15:41:32 +00:00
Kumar Aditya
94f4d87aeb
gh-131325: fix sendfile fallback implementation to drain data after writing to transport (#131376) 2025-03-18 00:52:57 +05:30
Kumar Aditya
7e3b788e8f
gh-128002: use efficient linked list implementation for eager tasks in asyncio (#130518) 2025-03-03 06:36:43 +00:00
Kumar Aditya
38d45d23a6
gh-129874: avoid mixing pure python and C impl in eager execution (#130515) 2025-02-24 15:37:59 +00:00
Bartosz Sławecki
7ed3dc6392
gh-128231: Use runcode() return value for failing early (GH-129488) 2025-02-24 15:50:13 +01:00
Kumar Aditya
660f126f87
gh-129898: per-thread current task implementation in asyncio (#129899)
Store the current running task on the thread state, it makes it thread safe for the free-threading build and while improving performance as there is no lock contention, this effectively makes it lock free.
When accessing the current task of the current running loop in current thread, no locking is required and can be acessed without locking.
In the rare case of accessing current task of a loop running in a different thread, the stop the world pauses is used in free-threading builds to stop all other running threads and find the task for the specified loop.

This also makes it easier for external introspection to find the current task, and now it will be always correct.
2025-02-19 16:34:49 +00:00
Kumar Aditya
a545749b0e
gh-130145: fix loop.run_forever when loop is already running (#130146) 2025-02-15 15:01:53 +05:30
Kumar Aditya
d5796e64e0
gh-129874: avoid mixing pure python and C implementation of asyncio (#129875) 2025-02-09 15:57:00 +05:30
Vojtěch Boček
4e38eeafe2
gh-115514: Fix incomplete writes after close while using ssl in asyncio(#128037)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-02 15:11:25 +00:00
Stan Ulbrych
bcb25d60b1
gh-129403: Fix ValueError messages in asyncio.Barrier and threading.Barrier (#129419)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-30 11:11:12 +03:00
Thomas Grainger
fccbfc40b5
gh-129195: use future_add_to_awaited_by/future_discard_from_awaited_by in asyncio.staggered.staggered_race (#129253)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-26 21:14:16 +05:30
Thomas Grainger
ec91e1c276
gh-128479: fix asyncio staggered race leaking tasks, and logging unhandled exception.append exception (#128475)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-23 16:53:53 +01:00
Yury Selivanov
188598851d
GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-01-22 17:25:29 +01:00
Thomas Grainger
ed6934e71e
gh-128588: gh-128550: remove eager tasks optimization that missed and introduced incorrect cancellations (#129063)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 17:13:01 +00:00
Thomas Grainger
38a9956876
gh-128308: pass **kwargs to asyncio task_factory (#128768)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 22:23:55 +05:30
Michał Górny
3829104ab4
gh-128916: Do not set SO_REUSEPORT on non-AF_INET* sockets (GH-128933)
* gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets

Do not attempt to set ``SO_REUSEPORT`` on sockets of address familifies other
than ``AF_INET`` and ``AF_INET6``, as it is meaningless with these address
families, and the call with fail with Linux kernel 6.12.9 and newer.

* Apply suggestions from code review

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>

---------

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-01-17 16:49:16 -08:00
Wang Ran (汪然)
1a1056d394
Fix typo in Lib/asyncio/futures.py (#128819) 2025-01-15 17:54:31 +05:30
Thomas Grainger
61b9811ac6
gh-128552: fix refcycles in eager task creation (#128553) 2025-01-07 11:44:57 +00:00
Michael H
7363476b64
gh-128559: Remove typing import from asyncio.timeouts (#128560) 2025-01-06 15:03:27 -08:00
Kumar Aditya
7e8c571604
gh-128340: add thread safe handle for loop.call_soon_threadsafe (#128369)
Adds `_ThreadSafeHandle` to be used for callbacks scheduled with `loop.call_soon_threadsafe`.
2025-01-06 18:05:11 +05:30
jb2170
830e10651b
gh-127529: Correct asyncio's accept_connection behaviour for handling ConnectionAbortedError (#127532)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-03 10:32:36 +00:00
Andrew Svetlov
0b5f1fae57
Mention loop_factory argument in docstring for asyncio.run() (#128288) 2024-12-27 14:58:35 +01:00