-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
gh-114091: Reword error message for unawaitable types #114090
gh-114091: Reword error message for unawaitable types #114090
Conversation
"object $type can't be ..." -> "'$type' object can't be ..."
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
This will need a NEWS entry since it's a user-visible change. That means you'll also need to create an issue, then rename this PR with the issue number (e.g., As for the contents, I like the change. What do you think though of instead changing the text of "'int' object is not awaitable'? That is even shorter, seems just as clear, and matches other errors like the subscript one. |
I agree and will implement this change. |
This doesn't look like something that would require an issue (though it does need a news blurb). IIRC it's possible to have a news entry without an issue? (You can try using the PR number as issue number in the blurb form.) |
I don't think so. |
"can't be used in 'await' expression" -> "can't be awaited"
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
…14090) Reword error message for unawaitable types.
…14090) Reword error message for unawaitable types.
…14090) Reword error message for unawaitable types.
Currently, attempting to await something that cannot be awaited results in this error message:
I recently encountered this for the first time when the unawaitable object was a method (which was not being called), and found the phrase "object method" unclear. This PR changes the error message so that the name of the class precedes the word "object" and appears in single quotes. A similar construction appears elsewhere in the code base.
Thank you to @JelleZijlstra and @godlygeek for their input to this PR (though they do not necessarily endorse it).