diff options
author | Xtreak <tir.karthi@gmail.com> | 2019-04-14 00:42:33 +0530 |
---|---|---|
committer | Pablo Galindo <Pablogsal@gmail.com> | 2019-04-13 20:12:33 +0100 |
commit | 830b43d03cc47a27a22a50d777f23c8e60820867 (patch) | |
tree | ebc93ae27d63c221fecc28a0b67d504563f8ec40 /Lib/unittest/mock.py | |
parent | fde9b33dfeedd4a4ed723b12d2330979dc684760 (diff) | |
download | cpython-git-830b43d03cc47a27a22a50d777f23c8e60820867.tar.gz |
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 .
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 8684f1dfa5..0e77f0e489 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -739,7 +739,7 @@ class NonCallableMock(Base): obj = self._mock_children.get(name, _missing) if name in self.__dict__: - super().__delattr__(name) + _safe_super(NonCallableMock, self).__delattr__(name) elif obj is _deleted: raise AttributeError(name) if obj is not _missing: |