python-trio / python-trio/trio
"Native" async generator-based context managers do not get KI protected
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.3k
- Forks
- 431
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 6
Description
This test code fails both currently_ki_protected assertions.
import trio
from async_generator import asynccontextmanager
@trio.hazmat.enable_ki_protection
@asynccontextmanager
async def bar():
assert trio.hazmat.currently_ki_protected()
yield 1234
assert trio.hazmat.currently_ki_protected()
async def foo():
async with bar() as num:
assert num == 1234
trio.run(foo)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied async generator-based context-manager example and inspect the interaction between trio.hazmat.enable_ki_protection and async_generator.asynccontextmanager. Done means both currently_ki_protected() assertions pass when the example is run with trio.run(foo).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100