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 fails with native coroutines
Type: Stage: resolved
Components: asyncio Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: yselivanov Nosy List: gvanrossum, habilain, larry, python-dev, vstinner, yselivanov
Priority: release blocker Keywords: patch

Created on 2015-08-14 15:26 by habilain, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_asyncio_task_get_frame.diff habilain, 2015-08-14 15:26 Patch to fix issue review
Messages (6)
msg248589 - (view) Author: David Griffin (habilain) * Date: 2015-08-14 15:26
I've been playing around with native coroutines and asyncio, and came across an issue with retrieving exceptions from tasks: The get_frame method on a Task in asyncio fails with an AttibuteError because it assumes that gi_frame as the attribute containing the stack frame; with native coroutines it's cr_frame.

I've attached a quick patch that just uses hasattr to see if gi_frame is present, and if not try cr_frame. This may not be the most elegant solution, but it does fix the issue. If there's any other stuff I can provide to help with this (within reason), just say the word.
msg248590 - (view) Author: David Griffin (habilain) * Date: 2015-08-14 15:27
It should be noted that when I said get_frame in the original comment, I actually meant get_stack
msg248607 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-08-14 19:35
New changeset 53d2a7c023bc by Yury Selivanov in branch '3.4':
Issue #24867: Fix Task.get_stack() for 'async def' coroutines
https://hg.python.org/cpython/rev/53d2a7c023bc

New changeset d25022765186 by Yury Selivanov in branch '3.5':
Merge 3.4 (Issue #24867)
https://hg.python.org/cpython/rev/d25022765186

New changeset c0b7829e3074 by Yury Selivanov in branch 'default':
Merge 3.5 (issue #24867)
https://hg.python.org/cpython/rev/c0b7829e3074
msg248608 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2015-08-14 19:37
Looks like we didn't have unittests for Task.get_stack()/Task.print_stack().

Anyways, it's now fixed, I'll make a PR for Larry to get this in 3.5.0rc2.
msg249083 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-08-24 23:59
Pull request accepted and merged.
msg249161 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-08-25 21:35
New changeset 595614c08eeb by Yury Selivanov in branch '3.5':
Issue #24867: Fix asyncio.Task.get_stack() for 'async def' coroutines
https://hg.python.org/cpython/rev/595614c08eeb

New changeset 9b28f41f1353 by Larry Hastings in branch '3.5':
Merged in 1st1/cpython350 (pull request #5)
https://hg.python.org/cpython/rev/9b28f41f1353

New changeset ad48d5a4ef40 by Larry Hastings in branch '3.5':
Add missing Misc/NEWS item for merged pull request for issue #24867.
https://hg.python.org/cpython/rev/ad48d5a4ef40
History
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 69055
2015-08-25 21:35:24python-devsetmessages: + msg249161
2015-08-24 23:59:12larrysetmessages: + msg249083
2015-08-14 19:37:17yselivanovsetstatus: open -> closed
priority: normal -> release blocker

assignee: yselivanov

nosy: + larry
messages: + msg248608
resolution: fixed
stage: resolved
2015-08-14 19:35:26python-devsetnosy: + python-dev
messages: + msg248607
2015-08-14 15:27:37habilainsetmessages: + msg248590
title: Asyncio get_frame fails with native coroutines -> Asyncio Task.get_stack fails with native coroutines
2015-08-14 15:26:22habilaincreate