remove selected objects from the given session, as though they were dereferenced and removed from WeakIdentityMap. Hardcodes the identity map's "all_states()" method to return the full list of states. This simulates the all_states() method returning results, afterwh
(self, sess, *objs)
| 2421 | _sessions.clear() |
| 2422 | |
| 2423 | def _set_imap_in_disposal(self, sess, *objs): |
| 2424 | """remove selected objects from the given session, as though |
| 2425 | they were dereferenced and removed from WeakIdentityMap. |
| 2426 | |
| 2427 | Hardcodes the identity map's "all_states()" method to return the |
| 2428 | full list of states. This simulates the all_states() method |
| 2429 | returning results, afterwhich some of the states get garbage |
| 2430 | collected (this normally only happens during asynchronous gc). |
| 2431 | The Session now has one or more InstanceState's which have been |
| 2432 | removed from the identity map and disposed. |
| 2433 | |
| 2434 | Will the Session not trip over this ??? Stay tuned. |
| 2435 | |
| 2436 | """ |
| 2437 | |
| 2438 | all_states = sess.identity_map.all_states() |
| 2439 | sess.identity_map.all_states = lambda: all_states |
| 2440 | for obj in objs: |
| 2441 | state = attributes.instance_state(obj) |
| 2442 | sess.identity_map.discard(state) |
| 2443 | state._dispose() |
| 2444 | |
| 2445 | def _test_session(self, **kwargs): |
| 2446 | T = self.classes.T |
no test coverage detected