Skip to content

asyncio.iscoroutinefunction has no docstring due to misplaced import statement #149694

@deadlovelll

Description

@deadlovelll

Bug report

Bug description:

In Lib/asyncio/coroutines.py, the iscoroutinefunction() function has its docstring placed after an import warnings statement, which makes the __doc__ method return None

MRE:

  >>> import asyncio
  >>> asyncio.iscoroutinefunction.__doc__ is None
  True

Expected:

  >>> asyncio.iscoroutinefunction.__doc__
  'Return True if func is a decorated coroutine function.'

Fix:
Move the import warnings statement below the docstring.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixesdocsDocumentation in the Doc dirstdlibStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Todo

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions