[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- stage: -> patch review type: -> behavior ___ Python tracker ___ ___ Python-bugs-list

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Copying my comment from GitHub : This issue occurs only when the mock module import and code are executed under tracing. In order to test this I have tried patching sys.modules to remove unittest.mock in order to trigger an import under tracing.

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- keywords: +patch pull_requests: +12718 stage: -> patch review ___ Python tracker ___ ___

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I think I got to this. See issue12370 (Use of super overwrites use of __class__ in class namespace) . msg138712 suggests a workaround to alias super at the module level. unittest.mock has the below line and NonCallableMock has __class__ defined as

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-11 Thread Ned Batchelder
Ned Batchelder added the comment: BTW, this started as a bug against coverage.py: https://github.com/nedbat/coveragepy/issues/795 There are some more details there, including the fact that it must be a Python trace function; a C trace function seems not to cause the problem. --

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-10 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: On an initial guess this is the change that went through and using object.__delattr__(self, name) instead of super().__delattr__(name) restores the old behavior and there are no test case failures. But I still have to check the change and how it's

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-10 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: There are very few changes to mock.py on bisecting with the example in the report is d358a8cda75446a8e0b5d99149f709395d5eae19 the problem? I am surprised by the reason this commit leads to change in behavior with set trace. ➜ cpython git:(master)

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-10 Thread Ned Batchelder
Change by Ned Batchelder : -- keywords: +3.7regression ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-10 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-10 Thread Ned Batchelder
Ned Batchelder added the comment: This also affects Python 3.8.0a3 -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue36593] Trace function interferes with MagicMock isinstance?

2019-04-10 Thread Ned Batchelder
New submission from Ned Batchelder : In Python 3.7.3, having a trace function in effect while mock is imported causes isinstance to be wrong for MagicMocks. I know, this sounds unlikely... $ cat traced_sscce.py # sscce.py import sys def trace(frame, event, arg): return trace if