Skip to content
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-67707: support partials in asyncio.iscoroutinefunction #94907

Closed

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Jul 16, 2022

@asyncio.coroutine has been removed in 3.11 so I'm not sure how useful this would be

@graingert graingert changed the base branch from 3.10 to main July 16, 2022 23:50
@graingert graingert force-pushed the asyncio-iscoroutinefunction-partials branch from 4867490 to 1c0cf0a Compare July 16, 2022 23:51
getattr(func, '_is_coroutine', None) is _is_coroutine)
return (
inspect.iscoroutinefunction(func)
or getattr(func, '_is_coroutine', None) is _is_coroutine
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to both check the attribute and unwrap the partial so it can support code that worked around this issue by doing:

        def sync_fn():
            pass

        partial_sync_fn = functools.partial(sync_fn)
        partial_sync_fn._is_coroutine = asyncio.coroutines._is_coroutine

@graingert
Copy link
Contributor Author

I'm closing this in favor of #94923

@graingert graingert closed this Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants