Fixes for 3.13
Fixes https://github.com/python-trio/trio/issues/3004, also refs https://github.com/python-trio/trio/issues/2885
@njsmith could you check my naive locals() -> sys._getframe().f_locals replacement? Unfortunately 3.13 makes locals() mutations not mutate actual local variables, as part of PEP 667. I'm especially not sure about the replacement in _run.py where locals() used to clear something (not sure what).
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.63%. Comparing base (
3350c11) to head (f62e81e).
Additional details and impacted files
@@ Coverage Diff @@
## master #3005 +/- ##
========================================
Coverage 99.63% 99.63%
========================================
Files 120 120
Lines 17783 17963 +180
Branches 3197 3243 +46
========================================
+ Hits 17718 17898 +180
Misses 46 46
Partials 19 19
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/trio/_core/_ki.py | 100.00% <100.00%> (ø) |
|
| src/trio/_core/_run.py | 99.38% <100.00%> (+0.04%) |
:arrow_up: |
| src/trio/_path.py | 100.00% <100.00%> (ø) |
|
| src/trio/_tests/test_exports.py | 99.61% <100.00%> (+<0.01%) |
:arrow_up: |
| src/trio/_tests/test_path.py | 100.00% <100.00%> (ø) |
|
| src/trio/_tools/gen_exports.py | 99.15% <100.00%> (ø) |
|
| src/trio/socket.py | 100.00% <ø> (ø) |
Seems like with these changes CancelScope.__exit__ doesn't need to inline the KI protection decorator anymore, so I pushed a commit on that.
I think this is ready for review/merge. While this applied as a patch doesn't seem to work, I can't seem to reproduce that and I'm sure it's just some other PR that changed things just enough for this subtle locals stuff to work (which can be located probably just using a git bisect?).
I think you can get 3.13 to pass in CI if you explicitly install cffi==1.17.0rc1 as a dependency: https://github.com/python-cffi/cffi/releases/tag/v1.17.0rc1
Since it's a release candidate pip doesn't automatically target it.
I wrote a PR to get trio-websocket to support trio>0.25 https://github.com/python-trio/trio-websocket/pull/188, so once merged that may fully resolve the issues encountered by the distro maintainers.
Alright, this is now running the whole test suite (rather than the part that doesn't require the test requirements).