Skip to content

Commit c51a9df

Browse files
authoredJun 12, 2020
style tweaks
1 parent 5e30c80 commit c51a9df

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

‎src/cs50/sql.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,10 @@ def execute(self, sql, *args, **kwargs):
131131
command = token.value.upper()
132132
break
133133

134-
# Begin a new session, if transaction started by caller (not using autocommit)
134+
# Begin a new session, if transaction opened by caller (not using autocommit)
135135
elif token.value.upper() in ["BEGIN", "START"]:
136136
if self._in_transaction:
137137
raise RuntimeError("transaction already open")
138-
139138
self._in_transaction = True
140139
else:
141140
command = None
@@ -323,8 +322,7 @@ def shutdown_session(exception=None):
323322
# If COMMIT or ROLLBACK, turn on autocommit mode
324323
if command in ["COMMIT", "ROLLBACK"] and "TO" not in (token.value for token in tokens):
325324
if not self._in_transaction:
326-
raise RuntimeError("transactions must be initiated with BEGIN or START TRANSACTION")
327-
325+
raise RuntimeError("transactions must be opened with BEGIN or START TRANSACTION")
328326
self._in_transaction = False
329327

330328
# Execute statement
@@ -395,7 +393,6 @@ def _close_session(self):
395393
"""Closes any existing session and resets instance variables."""
396394
if self._session is not None:
397395
self._session.close()
398-
399396
self._session = None
400397
self._in_transaction = False
401398

0 commit comments

Comments
 (0)
Please sign in to comment.