New submission from R. David Murray:
The get_stack method docs say:
"If the coroutine is active, returns the stack where it was suspended."
I presume this means something more like "if the coroutine is not done...", since in English you can't be both active *and* suspended. Or does it mean "last suspended"?
Then it talks about limit and how stacks limit returns newest frames while with tracebacks it is oldest frames...but the last sentence says that for suspended coroutines only one frame is returned.
So there is a definite lack of clarity here: can we get multiple frames if the coroutine is not suspended (in which case that first sentence seems likely to be the 'last suspended' interpretation), or for non-tracebacks can we only ever get one frame, in which case why talk about limit returning the newest frames for stacks?
---------- assignee: docs@python components: Documentation messages: 227401 nosy: docs@python, r.david.murray priority: normal severity: normal status: open title: asyncio task get_stack documentation seems to contradict itself type: behavior versions: Python 3.4, Python 3.5
Roundup Robot added the comment:
New changeset 4b6b03c1f4ff by Victor Stinner in branch '3.4': Closes #22475: asyncio doc, fix Task.get_stack() doc https://hg.python.org/cpython/rev/4b6b03c1f4ff
---------- nosy: +python-dev resolution: -> fixed stage: -> resolved status: open -> closed
STINNER Victor added the comment:
I fixed the most obvious issue in the documentation. I don't know the function enough to propose a better documentation, sorry.
Don't hesitate to write a patch on the documentation if you have a better explanation of how get_stack() behaves.
It is correct that get_stack() only returns 1 frame if the task is suspended, whereas it returns more frames if get_stack() is called while the task is running.