From: Mike Bayer Date: Wed, 1 Apr 2015 20:55:58 +0000 (-0400) Subject: - Added a list() call around a weak dictionary used within the X-Git-Tag: rel_1_0_0b5~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59816435dae75db9712f80c34734813a0246205a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Added a list() call around a weak dictionary used within the commit phase of the session, which without it could cause a "dictionary changed size during iter" error if garbage collection interacted within the process. Change was introduced by --- diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index 597c8adcd5..cf9ebc1a48 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -18,6 +18,15 @@ .. changelog:: :version: 1.0.0b5 + .. change:: + :tags: bug, orm + + Added a list() call around a weak dictionary used within the + commit phase of the session, which without it could cause + a "dictionary changed size during iter" error if garbage collection + interacted within the process. Change was introduced by + #3139. + .. change:: :tags: bug, postgresql :tickets: 3343 diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index bc9444040e..f3ad2349c3 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -300,7 +300,7 @@ class SessionTransaction(object): if not self.nested and self.session.expire_on_commit: for s in self.session.identity_map.all_states(): s._expire(s.dict, self.session.identity_map._modified) - for s in self._deleted: + for s in list(self._deleted): s._detach() self._deleted.clear() elif self.nested: