Skip to content

Conversation

@lisroach
Copy link
Contributor

@lisroach lisroach commented Sep 10, 2019

It should be possible that an awaitable object does not have a __code__, so technically checking for the __code__ attribute in _is_async_obj is incorrect. This faulty code check is also why things like: mock.MagicMock(spec=lambda x: x) evaluate to True, even though they are not asynchronous.

https://bugs.python.org/issue37251

@lisroach lisroach requested a review from asvetlov September 10, 2019 10:09
Copy link
Member

@tirkarthi tirkarthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks Lisa.

Copy link
Contributor

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asvetlov
Copy link
Contributor

Added backport label

@lisroach lisroach merged commit f1a297a into python:master Sep 10, 2019
@lisroach lisroach deleted the asyncmock_obj branch September 10, 2019 11:18
@miss-islington
Copy link
Contributor

Thanks @lisroach for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 10, 2019
@bedevere-bot
Copy link

GH-15837 is a backport of this pull request to the 3.8 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants