]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Added a conditional to the unpickling process for ORM
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 23 Apr 2013 17:23:48 +0000 (13:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 23 Apr 2013 17:23:48 +0000 (13:23 -0400)
mapped objects, such that if the reference to the object
were lost when the object was pickled, we don't
erroneously try to set up _sa_instance_state - fixes
a NoneType error.

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/orm/state.py

index 2a3d96ae01bfcc1955b9c9c5efee698807b09ca8..97b3626afc008925e6098128ed3cb6a06caaa122 100644 (file)
@@ -6,6 +6,15 @@
 .. changelog::
     :version: 0.8.1
 
+    .. change::
+      :tags: bug, orm
+
+      Added a conditional to the unpickling process for ORM
+      mapped objects, such that if the reference to the object
+      were lost when the object was pickled, we don't
+      erroneously try to set up _sa_instance_state - fixes
+      a NoneType error.
+
     .. change::
       :tags: bug, postgresql
       :tickets: 2712
index 193678c2ffa49bc851a9249f5df825454c63b70e..6ade91b3e078a629dd3448353e0215394b8f3555 100644 (file)
@@ -272,7 +272,8 @@ class InstanceState(interfaces._InspectionAttr):
         # setup _sa_instance_state ahead of time so that
         # unpickle events can access the object normally.
         # see [ticket:2362]
-        manager.setup_instance(inst, self)
+        if inst is not None:
+            manager.setup_instance(inst, self)
         manager.dispatch.unpickle(self, state)
 
     def _initialize(self, key):