Closed vmarkovtsev closed 4 years ago
Sorry, the problem is out of aiohttp scope.
asyncio.iscoroutinefunction()
(or ispect.iscoroutinefunction()
) should be fixed.
See also https://bugs.python.org/issue38225 discussion
@asvetlov when you are saying "out of scope", you really mean that I should file a dedicated bug report on bugs.python.org, correct?
I think we need to make decision about mentioned issue, select the attribute name, and write a patch for cpython. Nothing to do on aiohttp side
@asvetlov Sorry, I am not sure what you mean. aiohttp is irrelevant - this one I don't doubt and I understood at once :smile:
What decision? Do you mean whether that is officially acknowledged on bugs.python.org? Which attribute, do you mean __call__
? Why select the name? Do you mean adding another check in the iscoroutinefunction()
implementation? :question:
What shall I do in the end? Clone this issue to bugs.python.org? Submit a cpython patch for your consideration? Do nothing and you've got it covered?
I mean something like the following may work eventually after making https://bugs.python.org/issue38225 done:
class A:
async def __call__(self, *args):
pass
__call__.__async__ = True
I have no evidence if this feature will be implemented this way until a (not existing yet) pull request is landed. The next step on moving the issue forward is making a tested prototype. Caution, it can take longer and harder than you expect if you have no experience of hacking CPython.
Long story short
Class instance with
async def __call__
triggers DeprecationWarning: Bare functions are deprecated. This is different from #3252 wherefunctools.partial
generates a syncdef __call__
.Steps to reproduce
Your environment
Python 3.7.5 aiohttp 3.6.2