check if the attribute is set before deleting it with T_OBJECT_EX (fixes #7604)
Also, add a note to the docs about the better behavior of T_OBJECT_EX as
compared to T_OBJECT.
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 87d30eb..10b5af9 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1166,6 +1166,11 @@
del h
self.assertEqual(s.getvalue(), '')
+ class X(object):
+ __slots__ = "a"
+ with self.assertRaises(AttributeError):
+ del X().a
+
def test_slots_special(self):
# Testing __dict__ and __weakref__ in __slots__...
class D(object):