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:30:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554942628.57.0.616952219107.issue36593@roundup.psfhosted.org>
In-reply-to
Content
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 related to set trace.


diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 955af5d2b8..42fbc22e74 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -728,11 +728,10 @@ class NonCallableMock(Base):
                 # not set on the instance itself
                 return

-        if name in self.__dict__:
-            object.__delattr__(self, name)
-
         obj = self._mock_children.get(name, _missing)
-        if obj is _deleted:
+        if name in self.__dict__:
+            super().__delattr__(name)
+        elif obj is _deleted:
             raise AttributeError(name)
         if obj is not _missing:
             del self._mock_children[name]
History
Date User Action Args
2019-04-11 00:30:28xtreaksetrecipients: + xtreak, nedbat, pablogsal
2019-04-11 00:30:28xtreaksetmessageid: <1554942628.57.0.616952219107.issue36593@roundup.psfhosted.org>
2019-04-11 00:30:28xtreaklinkissue36593 messages
2019-04-11 00:30:28xtreakcreate