summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/state.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-01-28 13:48:05 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-01-28 13:48:05 -0500
commit029ae72b2fffc5a69acf7fc610377cd0a148870e (patch)
tree40cb58c19deeacfaf2c7f30507b0cafdf5066356 /lib/sqlalchemy/orm/state.py
parent4480eea62225951263892831190012dcea10c2e0 (diff)
downloadsqlalchemy-029ae72b2fffc5a69acf7fc610377cd0a148870e.tar.gz
- [bug] Fixed bug where unpickled object didn't
have enough of its state set up to work correctly within the unpickle() event established by the mutable object extension, if the object needed ORM attribute access within __eq__() or similar. [ticket:2362]
Diffstat (limited to 'lib/sqlalchemy/orm/state.py')
-rw-r--r--lib/sqlalchemy/orm/state.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/state.py b/lib/sqlalchemy/orm/state.py
index 117341275..4803ecdc3 100644
--- a/lib/sqlalchemy/orm/state.py
+++ b/lib/sqlalchemy/orm/state.py
@@ -187,6 +187,10 @@ class InstanceState(object):
if 'load_path' in state:
self.load_path = interfaces.deserialize_path(state['load_path'])
+ # setup _sa_instance_state ahead of time so that
+ # unpickle events can access the object normally.
+ # see [ticket:2362]
+ manager.setup_instance(inst, self)
manager.dispatch.unpickle(self, state)
def initialize(self, key):