(self, _to_root: bool = False)
| 1311 | SessionTransactionState.CLOSED, |
| 1312 | ) |
| 1313 | def commit(self, _to_root: bool = False) -> None: |
| 1314 | if self._state is not SessionTransactionState.PREPARED: |
| 1315 | with self._expect_state(SessionTransactionState.PREPARED): |
| 1316 | self._prepare_impl() |
| 1317 | |
| 1318 | if self._parent is None or self.nested: |
| 1319 | for conn, trans, should_commit, autoclose in set( |
| 1320 | self._connections.values() |
| 1321 | ): |
| 1322 | if should_commit: |
| 1323 | trans.commit() |
| 1324 | |
| 1325 | self._state = SessionTransactionState.COMMITTED |
| 1326 | self.session.dispatch.after_commit(self.session) |
| 1327 | |
| 1328 | self._remove_snapshot() |
| 1329 | |
| 1330 | with self._expect_state(SessionTransactionState.CLOSED): |
| 1331 | self.close() |
| 1332 | |
| 1333 | if _to_root and self._parent: |
| 1334 | self._parent.commit(_to_root=True) |
| 1335 | |
| 1336 | @_StateChange.declare_states( |
| 1337 | ( |
nothing calls this directly
no test coverage detected