Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use sys.get_asyncgen_hooks().finalizer to sniff io #28

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

graingert
Copy link
Member

@graingert graingert commented Aug 3, 2022

Fixes #20 #27

@graingert
Copy link
Member Author

This is based on the observation that the primary purpose of an async framework is to collect async generator objects, close them correctly and raise a resource warning.

sniffio is no longer answering the question of "what sort of object should I _async_yield", it's answering "if I de-reference a an async generator where does it go?"

sniffio/_impl.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 1, 2022

Codecov Report

Merging #28 (9ce0ca3) into master (0cfdab8) will decrease coverage by 9.17%.
The diff coverage is 80.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
- Coverage   96.51%   87.34%   -9.17%     
==========================================
  Files           4        4              
  Lines          86      158      +72     
  Branches       17       22       +5     
==========================================
+ Hits           83      138      +55     
- Misses          2       17      +15     
- Partials        1        3       +2     
Files Coverage Δ
sniffio/__init__.py 100.00% <ø> (ø)
sniffio/_tests/test_sniffio.py 100.00% <100.00%> (ø)
sniffio/_impl.py 68.75% <63.26%> (-22.16%) ⬇️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mis-detects curio as asyncio when running in curio in asyncio.to_thread (py3.9)
3 participants