741 if callable(node.converter):
742 try:
743 x = node.converter(raw)
744 except KeyboardInterrupt:745 raise
746 except Exception:
747 if node.retry:
2839 f.write(']\n')
2840 f.close()
2841
2842 except IOError as e:2843 raise
2844
2845
30 import distro as d
31 except ImportError:
32 d = None
33 except Exception: 34 raise
35 return d
36
130 docstr = inspect.getdoc(obj)
131 encoding = get_encoding(obj)
132 return cast_unicode(docstr, encoding=encoding)
133 except Exception: # pylint:disable=broad-except134 # Harden against an inspect failure, which can occur with
135 # SWIG-wrapped extensions.
136 raise
117 old_filename = execer.filename
118 execer.filename = filename
119 ccode = execer.compile(code, glbs=glb, locs=loc, mode=mode, filename=filename)
120 except Exception:121 raise
122 finally:
123 execer.filename = old_filename
Using raise
as the first or only operator of an except handler is useless because it raises back the exception immediately.
Remove the raise
operator or the entire try-except-raise
block.
try:
run_transaction(transaction_id)
except ValueError as e:
raise TransactionError(e)
except:
raise # This is unnecessary
try:
run_transaction(transaction_id)
except ValueError as e:
raise TransactionError(e)