Skip to content

Conversation

@graingert
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Oct 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.58716%. Comparing base (2a66a0d) to head (1fd9242).
Report is 302 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main       #3107         +/-   ##
===================================================
+ Coverage   99.58714%   99.58716%   +0.00001%     
===================================================
  Files            121         121                 
  Lines          18166       18167          +1     
  Branches        3275        3275                 
===================================================
+ Hits           18091       18092          +1     
  Misses            52          52                 
  Partials          23          23                 
Files with missing lines Coverage Δ
src/trio/_core/_run.py 99.02818% <100.00000%> (+0.00093%) ⬆️

@graingert
Copy link
Member Author

I'll write a test for this and shape it into a proper PR shortly

exc: BaseException | None,
tb: TracebackType | None,
) -> bool:
del tb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems intimidating, when you're adding a test could you add another to make sure no stackframes are getting lost? (I assume they're part of exc in addition?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tb is never needed in a context manager, and cpython are looking to deprecate the three arg form in favor of a one arg exc_value only form

# delete references from locals to avoid creating cycles
# see test_cancel_scope_exit_doesnt_create_cyclic_garbage
del _, combined_error_from_nursery, value, new_exc
del _, combined_error_from_nursery, value, new_exc, exc
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I misunderstood this. There's no cycle here because exc.__traceback__ doesn't see this frame

@graingert graingert closed this Oct 12, 2024
@graingert graingert deleted the fix-cyclic-garbage-in-nursery branch October 12, 2024 14:45
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.

2 participants