Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-37251: Removes __code__ check from _is_async_obj.#15830

Merged
lisroach merged 4 commits into
python:masterpython/cpython:masterfrom
lisroach:asyncmock_objlisroach/cpython:asyncmock_objCopy head branch name to clipboard
Sep 10, 2019
Merged

bpo-37251: Removes __code__ check from _is_async_obj.#15830
lisroach merged 4 commits into
python:masterpython/cpython:masterfrom
lisroach:asyncmock_objlisroach/cpython:asyncmock_objCopy head branch name to clipboard

Conversation

@lisroach

@lisroach lisroach commented Sep 10, 2019

Copy link
Copy Markdown
Contributor

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
Comment thread Misc/NEWS.d/next/Library/2019-09-10-10-59-50.bpo-37251.8zn2o3.rst Outdated

@tirkarthi tirkarthi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks Lisa.

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@asvetlov

Copy link
Copy Markdown
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
Copy Markdown
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
(cherry picked from commit f1a297a)

Co-authored-by: Lisa Roach <lisaroach14@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.