From 8fb0c0b4ce62bcbb88845c9860f3d702cb5b36e0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 9 Dec 2007 05:14:40 +0000 Subject: [PATCH] remove redundant identity map set --- lib/sqlalchemy/orm/unitofwork.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 02c230d08d..19642cc9d1 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -122,14 +122,15 @@ class UnitOfWork(object): elif state.dict['_instance_key'] != instance_key: # primary key switch - self.identity_map[instance_key] = state.obj() del self.identity_map[state.dict['_instance_key']] state.dict['_instance_key'] = instance_key if hasattr(state, 'insert_order'): delattr(state, 'insert_order') + self.identity_map[state.dict['_instance_key']] = state.obj() state.commit_all() + # remove from new last, might be the last strong ref self.new.pop(state, None) -- 2.47.3