We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
iscoroutinefunction doesn't work for partial bound methods. Consider this example. The second assert fails.
iscoroutinefunction
import asyncio import functools class A: async def a(self, x, y): pass assert asyncio.iscoroutinefunction(A().a) assert asyncio.iscoroutinefunction(functools.partial(A().a, 1))
I found two related issues:
The text was updated successfully, but these errors were encountered:
This seems to be fixed in #67707
Can confirm assertion passes on main branch. Python version3.12.0a0.
3.12.0a0
Sorry, something went wrong.
Yeah I double check that this issue was already fixed.
That's weird
Ah that's because the the parital of a bound method isn't going via while ismethod(f):, it passes inspect._signature_is_functionlike directly
while ismethod(f):
inspect._signature_is_functionlike
>>> import functools >>> class A: ... async def a(self, x, y): ... pass ... >>> A().a <bound method A.a of <__main__.A object at 0x7f8219707a30>> >>> import inspect >>> inspect._signature_is_functionlike(A().a) True >>> A().a.__code__.co_flags 195 >>>
>>> p = functools.partial(A().a) >>> inspect.ismethod(p) False >>> m = functools._unwrap_partial(p) >>> m <bound method A.a of <__main__.A object at 0x7f8219707a30>> >>> inspect.isfunction(m) False >>> inspect._signature_is_functionlike(m) True
No branches or pull requests
Bug report
iscoroutinefunction
doesn't work for partial bound methods. Consider this example. The second assert fails.I found two related issues:
Your environment
The text was updated successfully, but these errors were encountered: