Skip to content
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

Extend ASYNC110 to also warn if looping a checkpoint() #201

Closed
jakkdl opened this issue Feb 12, 2024 · 1 comment · Fixed by #221
Closed

Extend ASYNC110 to also warn if looping a checkpoint() #201

jakkdl opened this issue Feb 12, 2024 · 1 comment · Fixed by #221
Assignees

Comments

@jakkdl
Copy link
Member

jakkdl commented Feb 12, 2024

There being two sleep-related confusions can plausibly cause a bit of confusion, this code will raise TRIO115 (replace sleep(0) with checkpoint) and TRIO110 (replace looped sleep with an Event)

while foo():
  await trio.sleep(0)

but if the user resolves the ASYNC115, then ASYNC110 will also stop warning. I don't think it's something super common, but it happened in python-trio/trio#2947 (review) - so plausibly might happen again.

@Zac-HD
Copy link
Member

Zac-HD commented Feb 12, 2024

Yeah, makes sense - while ...: checkpoint() is pretty inefficient so hopefully it's also rare, but that's even more reason to add it to the rule 👍

@Zac-HD Zac-HD changed the title Extend TRIO110 to also warn if looping a checkpoint() Extend ASYNC110 to also warn if looping a checkpoint() Mar 13, 2024
@jakkdl jakkdl self-assigned this Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants