Skip to content

Commit d981368

Browse files
authored
Merge branch 'main' into updates
2 parents 14a9741 + 781c1c2 commit d981368

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: src/cs50/sql.py

+2
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ def teardown_appcontext(exception):
450450

451451
# If constraint violated
452452
except sqlalchemy.exc.IntegrityError as e:
453+
if self._autocommit:
454+
connection.execute(sqlalchemy.text("ROLLBACK"))
453455
self._logger.error(termcolor.colored(_statement, "red"))
454456
e = ValueError(e.orig)
455457
e.__cause__ = None

0 commit comments

Comments
 (0)