]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- The integer "id" used to link a mapped instance with
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 Sep 2011 14:32:39 +0000 (10:32 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 Sep 2011 14:32:39 +0000 (10:32 -0400)
its owning Session is now generated by a sequence
generation function rather than id(Session), to
eliminate the possibility of recycled id() values
causing an incorrect result, no need to check that
object actually in the session.  [ticket:2280]

CHANGES
lib/sqlalchemy/orm/session.py

diff --git a/CHANGES b/CHANGES
index c1c4b83b89225ad753c77b076c44fceb64290345..d3a5e4a33f3dcd2df5763690d4c35c519d001448 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -105,6 +105,13 @@ CHANGES
         to the mapper after it has already been configured.
         [ticket:2239]
 
+   - The integer "id" used to link a mapped instance with
+     its owning Session is now generated by a sequence
+     generation function rather than id(Session), to
+     eliminate the possibility of recycled id() values 
+     causing an incorrect result, no need to check that 
+     object actually in the session.  [ticket:2280]
+
 -sql
   - Behavioral improvement: empty
     conjunctions such as and_() and or_() will be
index 01404b8ea5592fe13ef8ccf244cef68167760fd7..3aa0d1de09b919b47199a6635cd2bdd9c100631d 100644 (file)
@@ -526,7 +526,7 @@ class Session(object):
         self.__binds = {}
         self._flushing = False
         self.transaction = None
-        self.hash_key = id(self)
+        self.hash_key = _new_sessionid()
         self.autoflush = autoflush
         self.autocommit = autocommit
         self.expire_on_commit = expire_on_commit
@@ -1814,3 +1814,4 @@ def _state_session(state):
             pass
     return None
 
+_new_sessionid = util.counter()