Uh oh!
There was an error while loading. Please reload this page.
[3.11] gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (GH-94050) - #94460
Conversation
pythonGH-94050) The inspect version was not working with unittest.mock.AsyncMock. The fix introduces special-casing of AsyncMock in `inspect.iscoroutinefunction` equivalent to the one performed in `asyncio.iscoroutinefunction`. Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 4261b6b) Co-authored-by: Mehdi ABAAKOUK <sileht@sileht.net>
miss-islington
commented
Jun 30, 2022
Status check is done, and it's a success ✅ . |
miss-islington
commented
Jun 30, 2022
Status check is done, and it's a success ✅ . |
graingert
commented
Jul 3, 2022
Isn't 3.11 and 3.10 in feature freeze? Cc @pablogsal |
pablogsal
commented
Jul 3, 2022
This is a bugfix, isn't it? The bug being they is was incorrectly identifying Maybe I am missing something, thought. |
graingert
commented
Jul 3, 2022
I read this as a feature change to allow duck typed Function-like objects to pass iscoroutinefunction/isgeneratorfunction/isasyncgeneratorfunction |
All the descriptions of the issue and the tests are about |
pablogsal
commented
Jul 3, 2022
@ambv Thoughts? |
Yeah this affects both more than AsyncMock and more than iscoroutinefunction |
graingert
commented
Jul 3, 2022
Also the notes in the PR reflect the old approach and not the approach used in the code:
|
pablogsal
commented
Jul 3, 2022
Hummm, @ambv I think this should then not have been backported. We should revert both backports |
cjw296
commented
Jul 3, 2022
I dunno, this feels like a bug that is being fixed. |
ambv
commented
Jul 4, 2022
I agree with @cjw296 that this is a bug fix. Instead of hard-coding I agree that the description of the PR could better indicate what the change is vs what problem it fixes. |
pablogsal
commented
Jul 4, 2022
Well, but wouldn't this affect other code that currently is behaving in a (arguably incorrect) given way? Technically that prevents the backport unless all possible affected code is surely doing it wrong. |
pablogsal
commented
Jul 4, 2022
At the very least, lest improve the NEWS entry, please. |
cjw296
commented
Jul 4, 2022
If it's behaving in an incorrect way before this fix, isn't that just another indication this is a bugfix? |
pablogsal
commented
Jul 4, 2022
Yes, as long as every affected case is behaving incorrectly. |
The inspect version was not working with unittest.mock.AsyncMock.
The fix introduces special-casing of AsyncMock in
inspect.iscoroutinefunctionequivalent to the oneperformed in
asyncio.iscoroutinefunction.Co-authored-by: Łukasz Langa lukasz@langa.pl
(cherry picked from commit 4261b6b)
Co-authored-by: Mehdi ABAAKOUK sileht@sileht.net