This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients nedbat, pablogsal, xtreak
Date 2019-04-11.00:19:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554941977.12.0.0365608572993.issue36593@roundup.psfhosted.org>
In-reply-to
Content
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) ✗ cat ../backups/bpo36593.py
import sys

def trace(frame, event, arg):
    return trace

if len(sys.argv) > 1:
    sys.settrace(trace)

from unittest.mock import MagicMock

class A:
    pass

m = MagicMock(spec=A)
print("isinstance: ", isinstance(m, A))
➜  cpython git:(master) ✗ git checkout d358a8cda75446a8e0b5d99149f709395d5eae19 Lib/unittest/mock.py
➜  cpython git:(master) ✗ ./python.exe ../backups/bpo36593.py 1
isinstance:  False
➜  cpython git:(master) ✗ git checkout d358a8cda75446a8e0b5d99149f709395d5eae19~1 Lib/unittest/mock.py
➜  cpython git:(master) ✗ ./python.exe ../backups/bpo36593.py 1
isinstance:  True

commit d358a8cda75446a8e0b5d99149f709395d5eae19
Author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Date:   Mon Jan 21 01:37:54 2019 -0800

    bpo-20239: Allow repeated deletion of unittest.mock.Mock attributes (GH-11629)

    * Allow repeated deletion of unittest.mock.Mock attributes

    * fixup! Allow repeated deletion of unittest.mock.Mock attributes

    * fixup! fixup! Allow repeated deletion of unittest.mock.Mock attributes
    (cherry picked from commit 222d303ade8aadf0adcae5190fac603bdcafe3f0)

    Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
History
Date User Action Args
2019-04-11 00:19:37xtreaksetrecipients: + xtreak, nedbat, pablogsal
2019-04-11 00:19:37xtreaksetmessageid: <1554941977.12.0.0365608572993.issue36593@roundup.psfhosted.org>
2019-04-11 00:19:37xtreaklinkissue36593 messages
2019-04-11 00:19:36xtreakcreate