Skip to content

Commit b31db8d

Browse files
committed
Remove useless try and inline expression
1 parent f87d49b commit b31db8d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

gino/transaction.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,8 @@ async def __aenter__(self):
167167

168168
async def __aexit__(self, ex_type, ex, ex_tb):
169169
is_break = ex_type is _Break
170-
if is_break and ex.commit:
171-
ex_type = None
172-
if ex_type is None:
173-
try:
174-
await self._tx.commit()
175-
except Exception:
176-
raise
170+
if is_break and ex.commit or ex_type is None:
171+
await self._tx.commit()
177172
else:
178173
await self._tx.rollback()
179174
if is_break and ex.tx is self:

0 commit comments

Comments
 (0)