Skip to content

Commit e18486c

Browse files
committed
fixes #178
1 parent 62ad33c commit e18486c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/cs50/sql.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ def teardown_appcontext(exception):
399399

400400
# If constraint violated
401401
except sqlalchemy.exc.IntegrityError as e:
402+
if self._autocommit:
403+
connection.execute(sqlalchemy.text("ROLLBACK"))
402404
self._logger.error(termcolor.colored(_statement, "red"))
403405
e = ValueError(e.orig)
404406
e.__cause__ = None

0 commit comments

Comments
 (0)