You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, attempting to await something that cannot be awaited results in this error message:
importasyncioasyncdefmain():
await1asyncio.run(main())
# TypeError: object int can't be used in 'await' expression
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.
>>>1[2]
TypeError: 'int'objectisnotsubscriptable
The PR already exists at #114090 but will be amended momentarily to implement changes suggested by Jelle and to resolve failed tests.
Feature or enhancement
Proposal:
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.
The PR already exists at #114090 but will be amended momentarily to implement changes suggested by Jelle and to resolve failed tests.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: