mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Close off the "Verre Carlo hack" as discussed on python-dev.
This commit is contained in:
parent
2fd02eb80f
commit
4dcdb78c6f
2 changed files with 39 additions and 0 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue