]> granicus.if.org Git - python/commit
bpo-36593: Fix isinstance check for Mock objects with spec executed under tracing...
authorXtreak <tir.karthi@gmail.com>
Sat, 13 Apr 2019 19:12:33 +0000 (00:42 +0530)
committerPablo Galindo <Pablogsal@gmail.com>
Sat, 13 Apr 2019 19:12:33 +0000 (20:12 +0100)
commit830b43d03cc47a27a22a50d777f23c8e60820867
treeebc93ae27d63c221fecc28a0b67d504563f8ec40
parentfde9b33dfeedd4a4ed723b12d2330979dc684760
bpo-36593: Fix isinstance check for Mock objects with spec executed under tracing (GH-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 .
Lib/unittest/mock.py
Lib/unittest/test/testmock/testmock.py
Misc/NEWS.d/next/Library/2019-04-11-22-11-24.bpo-36598.hfzDUl.rst [new file with mode: 0644]