complain when a class variable shadows a name in __slots__ (closes #12766)
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 1f2039e..3f68ee9 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4253,6 +4253,14 @@
foo = Foo()
str(foo)
+ def test_slot_shadows_class(self):
+ with self.assertRaises(ValueError) as cm:
+ class X:
+ __slots__ = ["foo"]
+ foo = None
+ m = str(cm.exception)
+ self.assertEqual("'foo' in __slots__ conflicts with class variable", m)
+
class DictProxyTests(unittest.TestCase):
def setUp(self):
class C(object):