trio icon indicating copy to clipboard operation
trio copied to clipboard

Defer KI if trio is doing IO

Open A5rocks opened this issue 9 months ago • 4 comments

Supersedes https://github.com/python-trio/trio/pull/1537.

As with that, fixes https://github.com/python-trio/trio/issues/151, first step of https://github.com/python-trio/trio/issues/733.

Additionally, fixes part of https://github.com/python-trio/trio/issues/3007 (not intentionally, just because it has to be done in order to still raise a KI. I should add a test.).

A5rocks avatar Mar 28 '25 01:03 A5rocks

codecov failure doesn't make any sense and seems to be a recent thing. I'm inclined to believe it's some change in how they normalize file names but I don't think it's worth chasing down for now.

A5rocks avatar Mar 28 '25 02:03 A5rocks

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.75077%. Comparing base (ea03051) to head (f83ebbb).

Additional details and impacted files
@@                 Coverage Diff                  @@
##                 main       #3233         +/-   ##
====================================================
- Coverage   100.00000%   99.75077%   -0.24923%     
====================================================
  Files             127         127                 
  Lines           19266       19259          -7     
  Branches         1301        1300          -1     
====================================================
- Hits            19266       19211         -55     
- Misses              0          45         +45     
- Partials            0           3          +3     
Files with missing lines Coverage Δ
src/trio/_core/_run.py 99.61353% <100.00000%> (-0.38648%) :arrow_down:
src/trio/_core/_tests/test_cancelled.py 100.00000% <100.00000%> (ø)
src/trio/_core/_tests/test_guest_mode.py 100.00000% <100.00000%> (ø)
src/trio/_core/_tests/test_ki.py 100.00000% <100.00000%> (ø)
src/trio/_repl.py 100.00000% <100.00000%> (ø)

... and 8 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Apr 11 '25 00:04 codecov[bot]

I can do the change to abort fn as a follow up -- it needs this change because the reason it's a function is because KI can be raised (which this change stops), but this change doesn't depend on it.

This isn't so much a summary but see https://github.com/python-trio/trio/issues/733#issuecomment-629126671 (this is ~just about that issue, other issues being closed is just because this is a Good Idea and unlocks easy fixes).

A5rocks avatar May 05 '25 16:05 A5rocks

Looking at #3030 makes me unsure whether this will work with that (specifically pressing ctrl+c when some async code is already running seems like it would break with this). I'd rather have that first, so I'll mark this as a draft.

I guess that PR doesn't actually touch the code I'm worried about, but I want to copy over whatever style of test case we figure out anyways.

A5rocks avatar Jun 29 '25 04:06 A5rocks