Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.4k
[3.11] gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (GH-94050)#94460
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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 oneperformed in `asyncio.iscoroutinefunction`.Co-authored-by: Łukasz Langa <lukasz@langa.pl>(cherry picked from commit4261b6b)Co-authored-by: Mehdi ABAAKOUK <sileht@sileht.net>
miss-islington commentedJun 30, 2022
Status check is done, and it's a success ✅ . |
miss-islington commentedJun 30, 2022
Status check is done, and it's a success ✅ . |
graingert commentedJul 3, 2022
Isn't 3.11 and 3.10 in feature freeze? Cc@pablogsal |
pablogsal commentedJul 3, 2022
This is a bugfix, isn't it? The bug being they is was incorrectly identifying Maybe I am missing something, thought. |
graingert commentedJul 3, 2022
I read this as a feature change to allow duck typed Function-like objects to pass iscoroutinefunction/isgeneratorfunction/isasyncgeneratorfunction |
pablogsal commentedJul 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
All the descriptions of the issue and the tests are about |
pablogsal commentedJul 3, 2022
@ambv Thoughts? |
graingert commentedJul 3, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yeah this affects both more than AsyncMock and more than iscoroutinefunction |
graingert commentedJul 3, 2022
Also the notes in the PR reflect the old approach and not the approach used in the code:
|
pablogsal commentedJul 3, 2022
Hummm,@ambv I think this should then not have been backported. We should revert both backports |
cjw296 commentedJul 3, 2022
I dunno, this feels like a bug that is being fixed. |
ambv commentedJul 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 commentedJul 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 commentedJul 4, 2022
At the very least, lest improve the NEWS entry, please. |
cjw296 commentedJul 4, 2022
If it's behaving in an incorrect way before this fix, isn't that just another indication this is a bugfix? |
pablogsal commentedJul 4, 2022
Yes, as long as every affected case is behaving incorrectly. |
Uh oh!
There was an error while loading.Please reload this page.
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 Langalukasz@langa.pl
(cherry picked from commit4261b6b)
Co-authored-by: Mehdi ABAAKOUKsileht@sileht.net