sniffio icon indicating copy to clipboard operation
sniffio copied to clipboard

use sys.get_asyncgen_hooks().finalizer to sniff io

Open graingert opened this issue 3 years ago • 2 comments

Fixes #20 #27

graingert avatar Aug 03 '22 01:08 graingert

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?"

graingert avatar Aug 03 '22 01:08 graingert

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%) :arrow_down:

codecov[bot] avatar Sep 01 '22 10:09 codecov[bot]