Skip to content

gh-67707: support partials in asyncio.iscoroutinefunction - #94907

Closed
graingert wants to merge 4 commits into
python:mainfrom
graingert:asyncio-iscoroutinefunction-partials
Closed

gh-67707: support partials in asyncio.iscoroutinefunction#94907
graingert wants to merge 4 commits into
python:mainfrom
graingert:asyncio-iscoroutinefunction-partials

Conversation

@graingert

@graingertgraingert commented Jul 16, 2022

Copy link
Copy Markdown
Contributor

@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 mainJuly 16, 2022 23:50
@graingert
graingertforce-pushed the asyncio-iscoroutinefunction-partials branch from 4867490 to 1c0cf0aCompareJuly 16, 2022 23:51
Comment threadLib/test/test_asyncio/test_tasks.py Outdated
getattr(func, '_is_coroutine', None) is _is_coroutine)
return (
inspect.iscoroutinefunction(func)
or getattr(func, '_is_coroutine', None) is _is_coroutine

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

I'm closing this in favor of #94923

Sign up for freeto 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

@graingert@bedevere-bot