From: Mike Bayer Date: Tue, 10 Jul 2007 20:38:40 +0000 (+0000) Subject: fixed small expunge() bug where object might not be present in session X-Git-Tag: rel_0_3_9~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c64a8ab5c05eb830f40980ded7fab541b1ca932;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git fixed small expunge() bug where object might not be present in session --- diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index c6b0b2689c..5f28d28e76 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -108,7 +108,7 @@ class UnitOfWork(object): echo = logging.echo_property() def _remove_deleted(self, obj): - if hasattr(obj, "_instance_key"): + if hasattr(obj, "_instance_key") and obj._instance_key in self.identity_map: del self.identity_map[obj._instance_key] try: self.deleted.remove(obj)