Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SyntaxWarning for await expession #144261

Open
Labels
stdlibStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancement
@Locked-chess-official

Description

@Locked-chess-official

Feature or enhancement

Proposal:

Now python has warned for const expression that impossible to successfully executed:

>>>1()<python-input-2>:1:SyntaxWarning:'int'objectisnotcallable;perhapsyoumissedacomma?Traceback (mostrecentcalllast):File"<python-input-2>",line1,in<module>1()~^^TypeError:'int'objectisnotcallable>>>1[2]<python-input-3>:1:SyntaxWarning:'int'objectisnotsubscriptable;perhapsyoumissedacomma?Traceback (mostrecentcalllast):File"<python-input-3>",line1,in<module>1[2]~^^^TypeError:'int'objectisnotsubscriptable

This feature want to enable the warning for await expressions:

asyncioREPL3.14.2 (tags/v3.14.2:df79316,Dec52025,17:18:21) [MSCv.194464bit (AMD64)]onwin32Use"await"directlyinsteadof"asyncio.run()".Type"help","copyright","credits"or"license"formoreinformation.>>>importasyncio>>>await1<python-input-0>:1:SyntaxWarning:'int'objectcan'tbeawaitedTraceback (mostrecentcalllast):File"C:\Users\hh180\AppData\Local\Programs\Python\Python314\Lib\concurrent\futures\_base.py",line450,inresultreturnself.__get_result()~~~~~~~~~~~~~~~~~^^File"C:\Users\hh180\AppData\Local\Programs\Python\Python314\Lib\concurrent\futures\_base.py",line395,in__get_resultraiseself._exceptionFile"<python-input-0>",line1,in<module>await1TypeError:'int'objectcan'tbeawaited

As I have known, there is no literal constant type that support for await (int, bool, float, complex, str, list, tuple, dict, set, ellipsis) so if there is only a constant after await we can safely warn it.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancement

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp