Thanks to visit codestin.com
Credit goes to github.com

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

WIP: Stackless issue #203: use the macro _PyStackless_TRY_STACKLESS #203

Closed
wants to merge 23 commits into from

Conversation

akruis
Copy link

@akruis akruis commented Jan 6, 2019

Replace _PyRuntime.st.try_stackless with the macro _PyStackless_TRY_STACKLESS.

Of this pull request only the commit f6dfdea and its children are relevant. This pull request must be merged only after pull request #198 has been merged.

Anselm Kruis and others added 23 commits December 29, 2018 22:56
…code

Refactor the finalisation code of stackless.tasklet and
stackless.channel.
- For tasklets, use a PEP 442 finalizer;
- for channels a simple tp_clear function is sufficient.

Like every PEP 442 other finalizer, the new finalizer runs only once for
each tasklet.
In order to prevent an endless loop in the tasklet-finalizer, try at
most 10 times to kill a tasklet.
Move the handling of tasklets with non-trivial C-state from
tasklet_traverse to tasklet_finalize. If a tasklet still has a
non-trivial C-state after killing the tasklet, the finalizer appends the
tasklet to gc.garbage. Now de-allocation caused by ref-counting behaves
identically to de-allocation caused by GC.
The gc-patch introduced by
stackless-dev/stackless_historic@35ba34f18 is
now obsolete.
Revert the patch, that added the function PyObject_GC_Collectable(). It
was introduced by 
stackless-dev/stackless_historic@35ba34f18.
See bpo-9141 for a discussion of this interesting patch.
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.
Fix a error handling in the YIELD_FROM finalisation code.
Add tests and changelog.txt
…t.run"

Enable stackless calls of method "contextvars.Context.run", if
soft-switching is enabled.
…ctions

Better handling of exceptions / NULL result values.
Move the macros to manipulate the try-stackless floag to the API.
Now it is possible to convert existing extension functions to stackless,
without using internal API.
Coming soon: test cases and documentation
Enable stackless calls of coroutines wrapped in "asyncio._CTask", if
soft-switching is enabled.
Needs test cases.
Depends on pull request python#198.
…ctions

Clean up the API header, add tests and documentation.
Remove an unused static function, add test cases and change-log.
@akruis akruis added this to the v3.7.x-slp milestone Jan 6, 2019
@akruis akruis self-assigned this Jan 6, 2019
@akruis akruis mentioned this pull request Jan 6, 2019
akruis pushed a commit that referenced this pull request Jan 12, 2019
instead of _PyRuntime.st.try_stackless.
@akruis
Copy link
Author

akruis commented Jan 12, 2019

Manually merged, see commit 60f321a.

@akruis akruis closed this Jan 12, 2019
@akruis akruis deleted the slp-issue-203 branch January 12, 2019 13:56
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.

1 participant