Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.7] bpo-36593: Fix isinstance check for Mock objects with spec executed under tracing (GH-12790) #12821

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2019

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Apr 13, 2019

In Python having a trace function in effect while mock is imported causes isinstance to be wrong for MagicMocks. This is due to the usage of super() in some class methods, as this sets the class attribute. To avoid this, as a workaround, alias the usage of super .
(cherry picked from commit 830b43d)

Co-authored-by: Xtreak [email protected]

https://bugs.python.org/issue36593

…nder tracing (pythonGH-12790)

In Python having a trace function in effect while mock is imported causes isinstance to be wrong for MagicMocks. This is due to the usage of super() in some class methods, as this sets the __class__ attribute. To avoid this, as a workaround, alias the usage of super .
(cherry picked from commit 830b43d)

Co-authored-by: Xtreak <[email protected]>
@miss-islington
Copy link
Contributor Author

@tirkarthi and @pablogsal: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit f3a9d72 into python:3.7 Apr 13, 2019
@miss-islington miss-islington deleted the backport-830b43d-3.7 branch April 13, 2019 19:32
@miss-islington
Copy link
Contributor Author

@tirkarthi and @pablogsal: Status check is done, and it's a success ✅ .

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.

5 participants