Remove the restoration state taken before a transaction began. Corresponds to a commit.
(self)
| 1128 | s._expire(s.dict, self.session.identity_map._modified) |
| 1129 | |
| 1130 | def _remove_snapshot(self) -> None: |
| 1131 | """Remove the restoration state taken before a transaction began. |
| 1132 | |
| 1133 | Corresponds to a commit. |
| 1134 | |
| 1135 | """ |
| 1136 | assert self._is_transaction_boundary |
| 1137 | |
| 1138 | if not self.nested and self.session.expire_on_commit: |
| 1139 | for s in self.session.identity_map.all_states(): |
| 1140 | s._expire(s.dict, self.session.identity_map._modified) |
| 1141 | |
| 1142 | statelib.InstanceState._detach_states( |
| 1143 | list(self._deleted), self.session |
| 1144 | ) |
| 1145 | self._deleted.clear() |
| 1146 | elif self.nested: |
| 1147 | parent = self._parent |
| 1148 | assert parent is not None |
| 1149 | parent._new.update(self._new) |
| 1150 | parent._dirty.update(self._dirty) |
| 1151 | parent._deleted.update(self._deleted) |
| 1152 | parent._key_switches.update(self._key_switches) |
| 1153 | |
| 1154 | @_StateChange.declare_states( |
| 1155 | (SessionTransactionState.ACTIVE,), _StateChangeStates.NO_CHANGE |
no test coverage detected