-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
add async120, await-in-except #265
Conversation
Co-authored-by: Zac Hatfield-Dodds <[email protected]>
for more information, see https://pre-commit.ci
I noticed the "exclude x.aclose()" just now, I don't remember the reasoning behind that, so idk if 120 should respect it as well. |
I just reread python-trio/trio#455 (comment) and noticed
and realized that this check does not filter on whether-the-except-would-otherwise-raise, so this will currently give an async120 error: try:
...
except ValueError:
# we don't give a shit about ValueError
await doSomeOtherThing() can fix it by saving the potential async120 errors in a container and only report them upon reaching a |
…arm on nested function definitions for 102 & 120
(I haven't forgotten this, I just need to think it through carefully and haven't had a block of time free to do that lately) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for your patience! Merge at your discretion.
tests/eval_files/async102.py
Outdated
try: | ||
... | ||
except: | ||
x = lambda: await foo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SyntaxError: 'await' outside async function
- there's no such thing as an async lambda.
We might want to check that our test files are syntactically valid to avoid any subtle issues in future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(more obvious errors have been caught in the past by mypy/ruff). Opened #268
Co-authored-by: Zac Hatfield-Dodds <[email protected]>
First part of #262
It's maybe not great to have the same error messages for both 102 and 120, and docs could maybe be improved as well.