https://github.com/python/cpython/commit/442ad232a1535618b0af842193f0560e8772b428
commit: 442ad232a1535618b0af842193f0560e8772b428
branch: 3.15
author: Pablo Galindo Salgado <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-10-04T22:30:00+01:00
summary:

[3.15] gh-149302: Fix incorrect docstring in RemoteUnwinder.get_all_awaited_by 
(GH-149312) (#158805)

Backport the corrected return structure and waiter descriptions. Regenerate 
Argument Clinic output for 3.15.

Co-authored-by: Shankarraospatil <[email protected]>

files:
M Modules/_remote_debugging/clinic/module.c.h
M Modules/_remote_debugging/module.c

diff --git a/Modules/_remote_debugging/clinic/module.c.h 
b/Modules/_remote_debugging/clinic/module.c.h
index 30fd0bbea020e5c..41e4f4bd443f7da 100644
--- a/Modules/_remote_debugging/clinic/module.c.h
+++ b/Modules/_remote_debugging/clinic/module.c.h
@@ -288,23 +288,25 @@ 
PyDoc_STRVAR(_remote_debugging_RemoteUnwinder_get_all_awaited_by__doc__,
 "get_all_awaited_by($self, /)\n"
 "--\n"
 "\n"
-"Get all tasks and their awaited_by relationships from the remote process.\n"
+"Get awaited_by relationships for tasks in the remote process.\n"
 "\n"
-"This provides a tree structure showing which tasks are waiting for\n"
-"other tasks.\n"
+"Returns:\n"
+"    A list of AwaitedInfo objects, where each object contains:\n"
+"\n"
+"    - thread_id (int): Identifier of the thread, or 0 for tasks in the\n"
+"      interpreter\'s fallback task list.\n"
+"    - awaited_by (list[TaskInfo]): Tasks registered with this thread.\n"
 "\n"
-"For each task, returns:\n"
-"1. The call stack frames leading to where the task is currently\n"
-"   executing\n"
-"2. The name of the task\n"
-"3. A list of tasks that this task is waiting for, with their own\n"
-"   frames/names/etc\n"
+"Each TaskInfo contains:\n"
+"    - task_id (int): Identifier of the task.\n"
+"    - task_name (str): Name of the task.\n"
+"    - coroutine_stack (list[CoroInfo]): Stack of coroutine frames.\n"
+"    - awaited_by (list[CoroInfo]): Coroutine information for tasks or 
futures\n"
+"      awaiting this task.\n"
 "\n"
-"Returns a list of [frames, task_name, subtasks] where:\n"
-"- frames: List of (func_name, filename, lineno) showing the call\n"
-"  stack\n"
-"- task_name: String identifier for the task\n"
-"- subtasks: List of tasks being awaited by this task, in same format\n"
+"Each CoroInfo contains:\n"
+"    - call_stack (list[FrameInfo]): Call stack frames for the coroutine.\n"
+"    - task_name (int): Identifier of the task or future.\n"
 "\n"
 "Raises:\n"
 "    RuntimeError: If AsyncioDebug section is not available in the\n"
@@ -313,20 +315,20 @@ 
PyDoc_STRVAR(_remote_debugging_RemoteUnwinder_get_all_awaited_by__doc__,
 "    OSError: If reading from the remote process fails\n"
 "\n"
 "Example output:\n"
-"[\n"
+"\n"
 "    [\n"
-"        [(\"c5\", \"script.py\", 10), (\"c4\", \"script.py\", 14)],\n"
-"        \"c2_root\",\n"
-"        [\n"
-"            [\n"
-"                [(\"c1\", \"script.py\", 23)],\n"
-"                \"sub_main_2\",\n"
-"                [...]\n"
-"            ],\n"
-"            [...]\n"
-"        ]\n"
-"    ]\n"
-"]");
+"        AwaitedInfo(\n"
+"            thread_id=12345,\n"
+"            awaited_by=[\n"
+"                TaskInfo(\n"
+"                    task_id=1,\n"
+"                    task_name=\"Task-1\",\n"
+"                    coroutine_stack=[...],\n"
+"                    awaited_by=[]\n"
+"                )\n"
+"            ]\n"
+"        )\n"
+"    ]");
 
 #define _REMOTE_DEBUGGING_REMOTEUNWINDER_GET_ALL_AWAITED_BY_METHODDEF    \
     {"get_all_awaited_by", 
(PyCFunction)_remote_debugging_RemoteUnwinder_get_all_awaited_by, METH_NOARGS, 
_remote_debugging_RemoteUnwinder_get_all_awaited_by__doc__},
@@ -1709,4 +1711,4 @@ _remote_debugging_get_gc_stats(PyObject *module, PyObject 
*const *args, Py_ssize
 exit:
     return return_value;
 }
-/*[clinic end generated code: output=88bcb21da5a25526 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=787493a0f8d48653 input=a9049054013a1b77]*/
diff --git a/Modules/_remote_debugging/module.c 
b/Modules/_remote_debugging/module.c
index abe996b46c1a4b4..5dff0f844c8bd6a 100644
--- a/Modules/_remote_debugging/module.c
+++ b/Modules/_remote_debugging/module.c
@@ -904,27 +904,29 @@ 
_remote_debugging_RemoteUnwinder_get_stack_trace_impl(RemoteUnwinderObject *self
 }
 
 /*[clinic input]
-@permit_long_summary
+@permit_long_docstring_body
 @critical_section
 _remote_debugging.RemoteUnwinder.get_all_awaited_by
 
-Get all tasks and their awaited_by relationships from the remote process.
+Get awaited_by relationships for tasks in the remote process.
+
+Returns:
+    A list of AwaitedInfo objects, where each object contains:
 
-This provides a tree structure showing which tasks are waiting for
-other tasks.
+    - thread_id (int): Identifier of the thread, or 0 for tasks in the
+      interpreter's fallback task list.
+    - awaited_by (list[TaskInfo]): Tasks registered with this thread.
 
-For each task, returns:
-1. The call stack frames leading to where the task is currently
-   executing
-2. The name of the task
-3. A list of tasks that this task is waiting for, with their own
-   frames/names/etc
+Each TaskInfo contains:
+    - task_id (int): Identifier of the task.
+    - task_name (str): Name of the task.
+    - coroutine_stack (list[CoroInfo]): Stack of coroutine frames.
+    - awaited_by (list[CoroInfo]): Coroutine information for tasks or futures
+      awaiting this task.
 
-Returns a list of [frames, task_name, subtasks] where:
-- frames: List of (func_name, filename, lineno) showing the call
-  stack
-- task_name: String identifier for the task
-- subtasks: List of tasks being awaited by this task, in same format
+Each CoroInfo contains:
+    - call_stack (list[FrameInfo]): Call stack frames for the coroutine.
+    - task_name (int): Identifier of the task or future.
 
 Raises:
     RuntimeError: If AsyncioDebug section is not available in the
@@ -933,29 +935,25 @@ Returns a list of [frames, task_name, subtasks] where:
     OSError: If reading from the remote process fails
 
 Example output:
-[
-    # Task c2_root waiting for two subtasks
+
     [
-        # Call stack of c2_root
-        [("c5", "script.py", 10), ("c4", "script.py", 14)],
-        "c2_root",
-        [
-            # First subtask (sub_main_2) and what it's waiting for
-            [
-                [("c1", "script.py", 23)],
-                "sub_main_2",
-                [...]
-            ],
-            # Second subtask and its waiters
-            [...]
-        ]
+        AwaitedInfo(
+            thread_id=12345,
+            awaited_by=[
+                TaskInfo(
+                    task_id=1,
+                    task_name="Task-1",
+                    coroutine_stack=[...],
+                    awaited_by=[]
+                )
+            ]
+        )
     ]
-]
 [clinic start generated code]*/
 
 static PyObject *
 _remote_debugging_RemoteUnwinder_get_all_awaited_by_impl(RemoteUnwinderObject 
*self)
-/*[clinic end generated code: output=6a49cd345e8aec53 input=c22bfee0612e0b69]*/
+/*[clinic end generated code: output=6a49cd345e8aec53 input=79e556b3973d21a8]*/
 {
     if (ensure_async_debug_offsets(self) < 0) {
         return NULL;

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to