summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-12-04 16:23:42 (GMT)
committerGuido van Rossum <guido@python.org>2001-12-04 16:23:42 (GMT)
commit6b70599450777a8b911f0eff44b18cd22f1c1e1e (patch)
tree10bb79dc54602e3226dd68774994e15a6d1af2b9 /Lib
parentebca9fc1ba23e58d734b9ab422da6a64fa4d72e2 (diff)
downloadcpython-6b70599450777a8b911f0eff44b18cd22f1c1e1e.zip
cpython-6b70599450777a8b911f0eff44b18cd22f1c1e1e.tar.gz
cpython-6b70599450777a8b911f0eff44b18cd22f1c1e1e.tar.bz2
Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
There's now a new structmember code, T_OBJECT_EX, which is used for all __slot__ variables (except __weakref__, which has special behavior anyway). This new code raises AttributeError when the variable is NULL rather than converting NULL to None.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_descr.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index d76013e..48d1138 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -978,19 +978,21 @@ def slots():
__slots__ = ['a']
x = C1()
verify(not hasattr(x, "__dict__"))
- vereq(x.a, None)
+ verify(not hasattr(x, "a"))
x.a = 1
vereq(x.a, 1)
+ x.a = None
+ veris(x.a, None)
del x.a
- vereq(x.a, None)
+ verify(not hasattr(x, "a"))
class C3(object):
__slots__ = ['a', 'b', 'c']
x = C3()
verify(not hasattr(x, "__dict__"))
- verify(x.a is None)
- verify(x.b is None)
- verify(x.c is None)
+ verify(not hasattr(x, 'a'))
+ verify(not hasattr(x, 'b'))
+ verify(not hasattr(x, 'c'))
x.a = 1
x.b = 2
x.c = 3