summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
commitb940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch)
tree0b9ea19eba1e665dac95126c3140ac2bc36326ad /Lib/test/test_descr.py
parent893523e80a2003d4a630aafb84ba016e0070cbbd (diff)
downloadcpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 2968e3d..96ff9f3 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -945,7 +945,7 @@ def mro_disagreement():
def raises(exc, expected, callable, *args):
try:
callable(*args)
- except exc, msg:
+ except exc as msg:
if not str(msg).startswith(expected):
raise TestFailed, "Message %r, expected %r" % (str(msg),
expected)
@@ -1813,7 +1813,7 @@ def weakrefs():
no = NoWeak()
try:
weakref.ref(no)
- except TypeError, msg:
+ except TypeError as msg:
verify(str(msg).find("weak reference") >= 0)
else:
verify(0, "weakref.ref(no) should be illegal")
@@ -1866,7 +1866,7 @@ def properties():
for attr in "__doc__", "fget", "fset", "fdel":
try:
setattr(raw, attr, 42)
- except TypeError, msg:
+ except TypeError as msg:
if str(msg).find('readonly') < 0:
raise TestFailed("when setting readonly attr %r on a "
"property, got unexpected TypeError "
@@ -2416,7 +2416,7 @@ f = t(%r, 'w') # rexec can't catch this by itself
for code in code1, code2, code3:
try:
sandbox.r_exec(code)
- except IOError, msg:
+ except IOError as msg:
if str(msg).find("restricted") >= 0:
outcome = "OK"
else:
@@ -3523,7 +3523,7 @@ def test_mutable_bases():
try:
D.__bases__ = ()
- except TypeError, msg:
+ except TypeError as msg:
if str(msg) == "a new-style class can't have only classic bases":
raise TestFailed, "wrong error message for .__bases__ = ()"
else: