summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-23 13:24:02 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-23 13:24:02 -0400
commit0f26f549191fc74bfebac319b39323cb865f7a50 (patch)
tree539985ed96c83f5ee7b0f0d3e7d6df63e283620a
parent7c8f977fc5e6c7e4ed329d217710c56aa0e18d70 (diff)
parent77e0a5dffe7950a729d6c16afbc70bb867af6dd8 (diff)
downloadsqlalchemy-0f26f549191fc74bfebac319b39323cb865f7a50.tar.gz
merge default
-rw-r--r--doc/build/changelog/changelog_08.rst9
-rw-r--r--lib/sqlalchemy/orm/state.py3
2 files changed, 11 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst
index 2a3d96ae0..97b3626af 100644
--- a/doc/build/changelog/changelog_08.rst
+++ b/doc/build/changelog/changelog_08.rst
@@ -7,6 +7,15 @@
: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
diff --git a/lib/sqlalchemy/orm/state.py b/lib/sqlalchemy/orm/state.py
index 193678c2f..6ade91b3e 100644
--- a/lib/sqlalchemy/orm/state.py
+++ b/lib/sqlalchemy/orm/state.py
@@ -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):