Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db2a902

Browse files
committed
Undo some (but not all) of the more lenient acceptance of
(AttributeError, TypeError) -- the leniency wasn't needed everywhere.
1 parent f0b35e1 commit db2a902

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Lib/test/test_funcattrs.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ def b():
3232

3333
try:
3434
del b.__dict__
35-
except (AttributeError, TypeError): pass
35+
except TypeError: pass
3636
else: raise TestFailed, 'del func.__dict__ expected TypeError'
3737

3838
b.publish = 1
3939
try:
4040
b.__dict__ = None
41-
except (AttributeError, TypeError): pass
41+
except TypeError: pass
4242
else: raise TestFailed, 'func.__dict__ = None expected TypeError'
4343

4444
d = {'hello': 'world'}
@@ -108,7 +108,7 @@ def b():
108108
# try setting __dict__
109109
try:
110110
F.a.__dict__ = (1, 2, 3)
111-
except (AttributeError, TypeError): pass
111+
except TypeError: pass
112112
else: raise TestFailed, 'expected TypeError'
113113

114114
F.a.im_func.__dict__ = {'one': 11, 'two': 22, 'three': 33}
@@ -121,7 +121,7 @@ def b():
121121

122122
try:
123123
F.a.__dict__ = d
124-
except (AttributeError, TypeError): pass
124+
except TypeError: pass
125125
else: raise TestFailed
126126

127127
if f2.a.one <> f1.a.one <> F.a.one <> 11:
@@ -171,17 +171,17 @@ def another():
171171

172172
try:
173173
del another.__dict__
174-
except (AttributeError, TypeError): pass
174+
except TypeError: pass
175175
else: raise TestFailed
176176

177177
try:
178178
del another.func_dict
179-
except (AttributeError, TypeError): pass
179+
except TypeError: pass
180180
else: raise TestFailed
181181

182182
try:
183183
another.func_dict = None
184-
except (AttributeError, TypeError): pass
184+
except TypeError: pass
185185
else: raise TestFailed
186186

187187
try:
@@ -218,13 +218,13 @@ def cantset(obj, name, value):
218218
verify(hasattr(obj, name)) # Otherwise it's probably a typo
219219
try:
220220
setattr(obj, name, value)
221-
except (AttributeError, TypeError):
221+
except TypeError:
222222
pass
223223
else:
224224
raise TestFailed, "shouldn't be able to set %s to %r" % (name, value)
225225
try:
226226
delattr(obj, name)
227-
except (AttributeError, TypeError):
227+
except TypeError:
228228
pass
229229
else:
230230
raise TestFailed, "shouldn't be able to del %s" % name

0 commit comments

Comments
 (0)