trio icon indicating copy to clipboard operation
trio copied to clipboard

gh-3108: Avoid materializing f_locals for KI protection

Open graingert opened this issue 1 year ago • 1 comments

Fixes https://github.com/python-trio/trio/issues/3108

In this pull request, we avoid materializing f_locals by using weak references to code objects instead.

graingert avatar Oct 13 '24 18:10 graingert

Codecov Report

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

Project coverage is 99.62377%. Comparing base (13d4bad) to head (5d76de2). Report is 250 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main       #3110         +/-   ##
===================================================
+ Coverage   99.58714%   99.62377%   +0.03662%     
===================================================
  Files            121         122          +1     
  Lines          18166       18340        +174     
  Branches        3268        3281         +13     
===================================================
+ Hits           18091       18271        +180     
+ Misses            52          47          -5     
+ Partials          23          22          -1     
Files with missing lines Coverage Δ
src/trio/_core/_ki.py 100.00000% <100.00000%> (ø)
src/trio/_core/_run.py 99.02344% <100.00000%> (-0.00381%) :arrow_down:
src/trio/_core/_run_context.py 100.00000% <100.00000%> (ø)
src/trio/_core/_tests/test_ki.py 99.77169% <100.00000%> (+1.93218%) :arrow_up:
src/trio/_core/_tests/test_run.py 100.00000% <100.00000%> (ø)
src/trio/_tools/gen_exports.py 95.90164% <100.00000%> (ø)

codecov[bot] avatar Oct 13 '24 18:10 codecov[bot]

It looks like this will fix https://github.com/python-trio/trio/issues/1752

and maybe in conjunction with https://github.com/python-trio/trio/pull/3112 it will fix this https://github.com/python-trio/trio/issues/2454

graingert avatar Oct 23 '24 09:10 graingert

Nevermind, I was thinking about whether a deprecation is possible but it isn't because the problem is functions having ki protection only sometimes.

A5rocks avatar Oct 24 '24 23:10 A5rocks

pre-commit.ci autofix

graingert avatar Oct 26 '24 09:10 graingert