Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Stackless issue #188: enable soft switching for sub-iterators, (async) generators and coroutines #188

Merged
merged 7 commits into from
Jan 12, 2019

Conversation

akruis
Copy link

@akruis akruis commented Nov 25, 2018

Enable soft switching for iterators/coroutines called by "yield from".
Work in progress, not functional, DO NOT MERGE!

@akruis
Copy link
Author

akruis commented Dec 28, 2018

Further progress needs #190 be resolved first.

@kristjanvalur
Copy link
Collaborator

The funny thing, is that "yield from" would be unnecessary if "stackless" soft-switching functionality (a c-stack less execution loop) had been widely embraced. As it is, it is a hack to switch contexts, something that stackless does more effectively and intuitively. And yet, we need to make stackless itself 'aware' of yield from . Tsk, tsk.

@akruis
Copy link
Author

akruis commented Dec 29, 2018

Yes, it is really unfortunate, all the more since Stackless like soft switching can be implemented in every programming language.

Anselm Kruis and others added 3 commits December 30, 2018 21:55
Enable soft switching for iterators/coroutines called by "yield from".
Work in progress, not functional, DO NOT MERGE!
…nd coroutines

Improve the finalisation of a soft switched YIELD_FROM instruction.
…ed methods

Enable stackless calls of the following methods:
- generator.send() (generator.__next__() was already stackless);
- coroutine.send();
- coroutine_wrapper.__next__() and coroutine_wrapper.send();
- async_generator_asend.__next__() and async_generator_asend.send().

This change needs more tests.
Anselm Kruis added 2 commits December 31, 2018 16:48
Fix a error handling in the YIELD_FROM finalisation code.
Add tests and changelog.txt
@akruis akruis changed the title WIP: Stackless: enable soft switching for sub-iterators and coroutines Stackless issue #188: enable soft switching for sub-iterators, (async) generators and coroutines Jan 1, 2019
@akruis
Copy link
Author

akruis commented Jan 1, 2019

It is ready now. This pull request enables stackless calls of sub-iterators and coroutines (technically: the YIELD_FROM opcode) and of the following methods, if soft-switching is enabled:

  • generator.send() (generator.__next__() was already stackless);
  • coroutine.send();
  • coroutine_wrapper.__next__() and coroutine_wrapper.send();
  • async_generator_asend.__next__() and async_generator_asend.send().

With this change it is possible to soft switch into/from the compound
statements "async for" and "async with".

@akruis akruis merged commit bb9dc7a into stackless-dev:master-slp Jan 12, 2019
@akruis akruis deleted the slp37-yield-from branch January 12, 2019 11:21
@akruis
Copy link
Author

akruis commented Jan 12, 2019

I didn't get any negative feedback yet. Therefore I'll commit the PR.

akruis pushed a commit that referenced this pull request Apr 18, 2021
This commit fixes an assert statement, that could fail since #188.
No functional change.
akruis pushed a commit that referenced this pull request Apr 18, 2021
This commit fixes an assert statement, that could fail since #188.
No functional change.

(cherry picked from commit 5595eec)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants