Skip to content

handle multiple withitems checkpointing each other #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 21, 2025

Conversation

jakkdl
Copy link
Member

@jakkdl jakkdl commented Apr 19, 2025

Also now handles autofixing async100 when there's multiple withitems, though it doesn't re-evaluate the With after autofixing so if a removed withitem was the only thing checkpointing another withitem, it doesn't clean up both.

fixes #367

also I have no clue how I totally hallucinated that asyncio.timeouts.timeout has ever been a thing??

… redundant timeouts with multiple withitems (although not when they also checkpoint each other)
Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

one concern, otherwise looks good!

Comment on lines 218 to 228
with (
- trio.fail_after(5), # error: 8, "trio", "fail_after"
- open("") as _,
- trio.move_on_after(5), # error: 8, "trio", "move_on_after"
- ):
- ...
-
- with (
- trio.move_on_after(10), # error: 8, "trio", "move_on_after"
open("") as f,
):
Copy link
Member

Choose a reason for hiding this comment

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

Seems like a bug here, that it removes the non-cancel-scope context manager too in this case?

Copy link
Member Author

@jakkdl jakkdl Apr 21, 2025

Choose a reason for hiding this comment

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

ah no, that's the diff being dumb - an open is "added" on line 207 (in the diff file). I'll add some comments to help the diff distinguish the withs

@jakkdl jakkdl enabled auto-merge (squash) April 21, 2025 09:59
@jakkdl jakkdl disabled auto-merge April 21, 2025 10:00
@jakkdl jakkdl enabled auto-merge (squash) April 21, 2025 10:03
@jakkdl jakkdl merged commit 66b8383 into python-trio:main Apr 21, 2025
9 of 10 checks passed
@jakkdl jakkdl deleted the multiple_with branch April 21, 2025 10:07
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.

False positives due to incorrect async with semantics
2 participants