@@ -543,6 +543,105 @@ configuration mechanisms).
543543.. seealso ::
544544 :pep: `741 `.
545545
546+ .. _whatsnew314-asyncio-introspection :
547+
548+ Asyncio introspection capabilities
549+ ----------------------------------
550+
551+ Added a new command-line interface to inspect running Python processes using
552+ asynchronous tasks, available via:
553+
554+ .. code-block :: bash
555+
556+ python -m asyncio ps PID
557+
558+ This tool inspects the given process ID (PID) and displays information about
559+ currently running asyncio tasks. It outputs a task table: a flat
560+ listing of all tasks, their names, their coroutine stacks, and which tasks are
561+ awaiting them.
562+
563+ .. code-block :: bash
564+
565+ python -m asyncio pstree PID
566+
567+ This tool fetches the same information, but renders a visual async call tree,
568+ showing coroutine relationships in a hierarchical format. This command is
569+ particularly useful for debugging long-running or stuck asynchronous programs.
570+ It can help developers quickly identify where a program is blocked, what tasks
571+ are pending, and how coroutines are chained together.
572+
573+ For example given this code:
574+
575+ .. code-block :: python
576+
577+ import asyncio
578+
579+ async def play (track ):
580+ await asyncio.sleep(5 )
581+ print (f " 🎵 Finished: { track} " )
582+
583+ async def album (name , tracks ):
584+ async with asyncio.TaskGroup() as tg:
585+ for track in tracks:
586+ tg.create_task(play(track), name = track)
587+
588+ async def main ():
589+ async with asyncio.TaskGroup() as tg:
590+ tg.create_task(
591+ album(" Sundowning" , [" TNDNBTG" , " Levitate" ]), name = " Sundowning" )
592+ tg.create_task(
593+ album(" TMBTE" , [" DYWTYLM" , " Aqua Regia" ]), name = " TMBTE" )
594+
595+ if __name__ == " __main__" :
596+ asyncio.run(main())
597+
598+ Executing the new tool on the running process will yield a table like this:
599+
600+ .. code-block :: bash
601+
602+ python -m asyncio ps 12345
603+
604+ tid task id task name coroutine chain awaiter name awaiter id
605+ ---------------------------------------------------------------------------------------------------------------------------------------
606+ 8138752 0x564bd3d0210 Task-1 0x0
607+ 8138752 0x564bd3d0410 Sundowning _aexit -> __aexit__ -> main Task-1 0x564bd3d0210
608+ 8138752 0x564bd3d0610 TMBTE _aexit -> __aexit__ -> main Task-1 0x564bd3d0210
609+ 8138752 0x564bd3d0810 TNDNBTG _aexit -> __aexit__ -> album Sundowning 0x564bd3d0410
610+ 8138752 0x564bd3d0a10 Levitate _aexit -> __aexit__ -> album Sundowning 0x564bd3d0410
611+ 8138752 0x564bd3e0550 DYWTYLM _aexit -> __aexit__ -> album TMBTE 0x564bd3d0610
612+ 8138752 0x564bd3e0710 Aqua Regia _aexit -> __aexit__ -> album TMBTE 0x564bd3d0610
613+
614+
615+ or:
616+
617+ .. code-block :: bash
618+
619+ python -m asyncio pstree 12345
620+
621+ └── (T) Task-1
622+ └── main
623+ └── __aexit__
624+ └── _aexit
625+ ├── (T) Sundowning
626+ │ └── album
627+ │ └── __aexit__
628+ │ └── _aexit
629+ │ ├── (T) TNDNBTG
630+ │ └── (T) Levitate
631+ └── (T) TMBTE
632+ └── album
633+ └── __aexit__
634+ └── _aexit
635+ ├── (T) DYWTYLM
636+ └── (T) Aqua Regia
637+
638+ If a cycle is detected in the async await graph (which could indicate a
639+ programming issue), the tool raises an error and lists the cycle paths that
640+ prevent tree construction.
641+
642+ (Contributed by Pablo Galindo, Łukasz Langa, Yury Selivanov, and Marta
643+ Gomez Macias in :gh: `91048 `.)
644+
546645.. _whatsnew314-tail-call :
547646
548647A new type of interpreter
@@ -891,6 +990,14 @@ ctypes
891990 making it a :term: `generic type `.
892991 (Contributed by Brian Schubert in :gh: `132168 `.)
893992
993+ curses
994+ ------
995+
996+ * Add the :func: `~curses.assume_default_colors ` function,
997+ a refinement of the :func: `~curses.use_default_colors ` function which
998+ allows to change the color pair ``0 ``.
999+ (Contributed by Serhiy Storchaka in :gh: `133139 `.)
1000+
8941001datetime
8951002--------
8961003
0 commit comments