Skip to content

Commit 72acd1c

Browse files
committed
slight improvement to except fix
1 parent 19b1966 commit 72acd1c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

pyupgrade/_plugins/exceptions.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ def _fix_except(
5252
start = find_op(tokens, except_index, '(')
5353
func_args, end = parse_call_args(tokens, start)
5454

55-
# save the exceptions and remove the block
5655
arg_strs = [arg_str(tokens, *arg) for arg in func_args]
57-
del tokens[start:end]
5856

5957
# rewrite the block without dupes
6058
args = []
@@ -74,8 +72,7 @@ def _fix_except(
7472
else:
7573
joined = unique_args[0]
7674

77-
new = Token('CODE', joined)
78-
tokens.insert(start, new)
75+
tokens[start:end] = [Token('CODE', joined)]
7976

8077

8178
def _get_rewrite(

0 commit comments

Comments
 (0)