This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: asyncio task get_stack documentation seems to contradict itself
Type: behavior Stage: resolved
Components: asyncio, Documentation Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, giampaolo.rodola, gvanrossum, pitrou, python-dev, r.david.murray, vstinner, yselivanov
Priority: normal Keywords:

Created on 2014-09-24 00:51 by r.david.murray, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg227401 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-09-24 00:51
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?
msg232022 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-12-02 17:02
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
msg232023 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-12-02 17:04
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.
History
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66665
2014-12-02 17:04:23vstinnersetmessages: + msg232023
2014-12-02 17:02:49python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg232022

resolution: fixed
stage: resolved
2014-09-24 14:28:04vstinnersetcomponents: + asyncio
2014-09-24 08:50:39pitrousetnosy: + gvanrossum, pitrou, vstinner, giampaolo.rodola, yselivanov
2014-09-24 00:51:49r.david.murraycreate