SF 569257 -- Name mangle double underscored variable names in __slots__.
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 2129a7b..dca8ea1 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1060,6 +1060,24 @@
vereq(x.b, 2)
vereq(x.c, 3)
+ class C4(object):
+ """Validate name mangling"""
+ __slots__ = ['__a']
+ def __init__(self, value):
+ self.__a = value
+ def get(self):
+ return self.__a
+ x = C4(5)
+ verify(not hasattr(x, '__dict__'))
+ verify(not hasattr(x, '__a'))
+ vereq(x.get(), 5)
+ try:
+ x.__a = 6
+ except AttributeError:
+ pass
+ else:
+ raise TestFailed, "Double underscored names not mangled"
+
# Make sure slot names are proper identifiers
try:
class C(object):