msg245338 - (view) |
Author: Benno Leslie (bennoleslie) * |
Date: 2015-06-14 10:29 |
When a co-routine has delegated computation to another co-routine via "yield from", it is useful to be able to access the delegated-to co-routine.
This proposed enhancement would add a new calculated property to the generator object called "gi_yieldfrom", which returns the delegated-to co-routine (or None).
|
msg245340 - (view) |
Author: Benno Leslie (bennoleslie) * |
Date: 2015-06-14 10:48 |
Attached is my first attempt at implementing this feature.
It includes to implementation, updates to documentation, and added test cases.
I'm not a regular contributor so look forward to any feedback on improving the patch.
|
msg245341 - (view) |
Author: Martin Panter (martin.panter) * |
Date: 2015-06-14 11:43 |
I left some comments on Reitveld.
Does this also apply to the new “async def” native coroutines? If not, I think it should be made to.
|
msg245441 - (view) |
Author: Yury Selivanov (yselivanov) * |
Date: 2015-06-17 16:50 |
I think we need some feedback from PyPy & Jython guys on this. I'm not sure that they can expose 'yieldfrom' slot without some performance penalties.
|
msg245447 - (view) |
Author: Armin Rigo (arigo) * |
Date: 2015-06-17 20:39 |
No problem from PyPy.
|
msg245461 - (view) |
Author: Benno Leslie (bennoleslie) * |
Date: 2015-06-18 11:15 |
I've tried to address all the issues raised in the review of the first patch.
|
msg245491 - (view) |
Author: Alyssa Coghlan (ncoghlan) * |
Date: 2015-06-19 05:17 |
Marking this as dependent on issue 24400, as that refactors the PEP 492 implementation to make coroutines their own type (albeit one that shares a memory layout and some attribute names with generators at the C layer).
I'd suggest cr_await as the calculated property for coroutines that corresponds to gi_yieldfrom for generators.
|
msg245496 - (view) |
Author: Stefan Behnel (scoder) * |
Date: 2015-06-19 09:15 |
No problem for Cython either.
The change in issue 24400 that makes coroutines real Awaitables also removes surprises for a "cr_await" return value being a coroutine and previously *not* an Awaitable.
The contract for "gi_yieldfrom" is only that the returned value is an Iterator, IIUC?
|
msg245658 - (view) |
Author: Yury Selivanov (yselivanov) * |
Date: 2015-06-22 22:26 |
Please find attached a new patch that exposes 'cr_await' attribute on coroutine objects. I don't think we can merge 'gi_yieldfrom' in 3.5, but 'cr_await' should probably be fine.
|
msg245664 - (view) |
Author: Alyssa Coghlan (ncoghlan) * |
Date: 2015-06-23 04:12 |
Guido indicated on python-dev that he considered it reasonable to view adding gi_yieldfrom as part of the PEP 492 implementation: https://mail.python.org/pipermail/python-dev/2015-June/140498.html
That perspective makes sense to me as well, since it preserves the functional equivalence of native coroutines (cr_await) and generator based coroutines (gi_yieldfrom) from a state introspection perspective.
I've added Larry to the nosy list here to give him the option of veto'ing as release manager, but I think we want both in order to get full debuggability benefits.
|
msg245732 - (view) |
Author: Martin Panter (martin.panter) * |
Date: 2015-06-24 12:04 |
For Benno’s original gi_yieldfrom property, I guess the asyncio.coroutines.CoroWrapper class would need updating. The GeneratorWrapper class for @types.coroutine probably should be updated too, since it already supports other internal generator properties.
|
msg245765 - (view) |
Author: Yury Selivanov (yselivanov) * |
Date: 2015-06-24 17:06 |
Larry, what's your opinion on this?
cr_await is a new thing (trivial on the C level) on a new type, it shouldn't break anything. gi_yieldfrom is identical to cr_await. Can we add this to 3.5?
|
msg245767 - (view) |
Author: Frank Wierzbicki (fwierzbicki) * |
Date: 2015-06-24 18:20 |
This shouldn't be a problem for Jython.
|
msg246113 - (view) |
Author: Larry Hastings (larry) * |
Date: 2015-07-03 00:53 |
I'll accept it for 3.5. Can it go in for beta 3, tagged in 48 hours?
|
msg246124 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2015-07-03 04:24 |
New changeset 84eb9a020011 by Yury Selivanov in branch '3.5':
Issue #24450: Add gi_yieldfrom to generators; cr_await to coroutines.
https://hg.python.org/cpython/rev/84eb9a020011
New changeset f4058528ab8c by Yury Selivanov in branch 'default':
Merge 3.5 (Issue #24450)
https://hg.python.org/cpython/rev/f4058528ab8c
|
msg246125 - (view) |
Author: Yury Selivanov (yselivanov) * |
Date: 2015-07-03 04:25 |
Benno, thanks for coming up with the idea and for the patches. Larry, thanks for approving this for 3.5!
|
msg246128 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2015-07-03 04:35 |
New changeset 9bae275e99b3 by Yury Selivanov in branch '3.5':
Issue #24450: Proxy cr_await and gi_yieldfrom in @types.coroutine
https://hg.python.org/cpython/rev/9bae275e99b3
New changeset 4d3bd9b82a62 by Yury Selivanov in branch 'default':
Merge 3.5 (Issue #24450)
https://hg.python.org/cpython/rev/4d3bd9b82a62
|
msg246131 - (view) |
Author: Roundup Robot (python-dev) |
Date: 2015-07-03 04:42 |
New changeset 34460219c0e0 by Yury Selivanov in branch '3.4':
Issue #24450: Proxy gi_yieldfrom & cr_await in asyncio.CoroWrapper
https://hg.python.org/cpython/rev/34460219c0e0
New changeset 3555f7b5eac6 by Yury Selivanov in branch '3.5':
Merge 3.4 (Issue #24450)
https://hg.python.org/cpython/rev/3555f7b5eac6
New changeset 5e9f794fd776 by Yury Selivanov in branch 'default':
Merge 3.5 (Issue #24450)
https://hg.python.org/cpython/rev/5e9f794fd776
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:18 | admin | set | github: 68638 |
2015-07-03 04:42:15 | python-dev | set | messages:
+ msg246131 |
2015-07-03 04:35:49 | python-dev | set | messages:
+ msg246128 |
2015-07-03 04:25:26 | yselivanov | set | status: open -> closed versions:
+ Python 3.6 messages:
+ msg246125
resolution: fixed stage: patch review -> resolved |
2015-07-03 04:24:25 | python-dev | set | nosy:
+ python-dev messages:
+ msg246124
|
2015-07-03 00:53:34 | larry | set | messages:
+ msg246113 |
2015-06-24 18:20:30 | fwierzbicki | set | messages:
+ msg245767 |
2015-06-24 17:06:11 | yselivanov | set | messages:
+ msg245765 |
2015-06-24 12:09:50 | arigo | set | nosy:
- arigo
|
2015-06-24 12:04:23 | martin.panter | set | messages:
+ msg245732 |
2015-06-23 04:12:29 | ncoghlan | set | nosy:
+ larry messages:
+ msg245664
|
2015-06-22 22:40:05 | yselivanov | set | title: Add gi_yieldfrom calculated property to generator object -> Add cr_await calculated property to coroutine object |
2015-06-22 22:26:14 | yselivanov | set | files:
+ cr_await.patch
messages:
+ msg245658 |
2015-06-19 09:15:57 | scoder | set | messages:
+ msg245496 |
2015-06-19 09:08:10 | scoder | set | nosy:
+ scoder
|
2015-06-19 05:17:46 | ncoghlan | set | nosy:
+ ncoghlan dependencies:
+ Awaitable ABC incompatible with functools.singledispatch messages:
+ msg245491
|
2015-06-18 11:15:13 | bennoleslie | set | files:
+ gi_yieldfrom.v1.patch
messages:
+ msg245461 |
2015-06-17 20:47:52 | yselivanov | set | nosy:
+ fwierzbicki
|
2015-06-17 20:39:17 | arigo | set | messages:
+ msg245447 |
2015-06-17 19:47:24 | yselivanov | set | nosy:
+ arigo
|
2015-06-17 17:06:11 | yselivanov | set | assignee: yselivanov |
2015-06-17 16:50:03 | yselivanov | set | nosy:
+ yselivanov messages:
+ msg245441
|
2015-06-15 02:06:48 | ethan.furman | set | nosy:
+ ethan.furman
|
2015-06-14 11:43:10 | martin.panter | set | nosy:
+ martin.panter
messages:
+ msg245341 stage: patch review |
2015-06-14 10:48:39 | bennoleslie | set | files:
+ gi_yieldfrom.v0.patch keywords:
+ patch messages:
+ msg245340
|
2015-06-14 10:29:47 | bennoleslie | create | |