summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-14 21:46:03 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-14 21:46:03 (GMT)
commit4dcdb78c6ffd203c9d72ef41638cc4a0e3857adf (patch)
tree8004c2c85681d2379d1a0c8d319e4506517666bb /Lib
parent2fd02eb80fdfd7b651d3df7e09a0b076e126cc03 (diff)
downloadcpython-4dcdb78c6ffd203c9d72ef41638cc4a0e3857adf.zip
cpython-4dcdb78c6ffd203c9d72ef41638cc4a0e3857adf.tar.gz
cpython-4dcdb78c6ffd203c9d72ef41638cc4a0e3857adf.tar.bz2
Close off the "Verre Carlo hack" as discussed on python-dev.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_descr.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 507938e..37d8b65 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3840,6 +3840,22 @@ def proxysuper():
p = Proxy(obj)
vereq(C.__dict__["f"](p), "B.f->C.f")
+def verrecarlo():
+ if verbose:
+ print "Testing prohibition of Verre Carlo's hack..."
+ try:
+ object.__setattr__(str, "foo", 42)
+ except TypeError:
+ pass
+ else:
+ raise TestFailed, "Verre Carlo __setattr__ suceeded!"
+ try:
+ object.__delattr__(str, "lower")
+ except TypeError:
+ pass
+ else:
+ raise TestFailed, "Verre Carlo __delattr__ succeeded!"
+
def test_main():
do_this_first()
@@ -3929,6 +3945,7 @@ def test_main():
meth_class_get()
isinst_isclass()
proxysuper()
+ verrecarlo()
if verbose: print "All OK"