Skip to content

[BUG] inspect.iscoroutinefunction call on async method is False #4138

@jakirkham

Description

@jakirkham

Describe the bug

When Cythonizing a class that contains an async method, it appears inspect.iscoroutinefunction returns False. If the same class were not Cythonized, passing the async method to inspect.iscoroutinefunction returns True.

To Reproduce
Code to reproduce the behaviour:

import inspect


class C:
    async def m(self):
        pass


assert inspect.iscoroutinefunction(C.m)  # <--- Fails when Cythonized. Passes in pure Python

Expected behavior

inspect.iscoroutinefunction having the same result whether the class is Cythonized or not.

Environment (please complete the following information):

  • OS: macOS
  • Python version: 3.8.8
  • Cython version: 0.29.23

Additional context

NA

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions