From: Mike Bayer Date: Wed, 15 Aug 2007 01:25:13 +0000 (+0000) Subject: removed init_attr() call, which has shown to not increase performance X-Git-Tag: rel_0_4beta3~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=651e9ff67330a78b088323e32a4fe4791687c117;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git removed init_attr() call, which has shown to not increase performance --- diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 6218371e0a..c9dfc7fce3 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -708,17 +708,6 @@ class AttributeManager(object): return True return object._state.get('modified', False) - def init_attr(self, obj): - """Sets up the __sa_attr_state dictionary on the given instance. - - This dictionary is automatically created when the `_state` - attribute of the class is first accessed, but calling it here - will save a single throw of an ``AttributeError`` that occurs - in that creation step. - """ - - setattr(obj, '_%s__sa_attr_state' % obj.__class__.__name__, {}) - def get_history(self, obj, key, **kwargs): """Return a new ``AttributeHistory`` object for the given attribute on the given object. diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 9608c0f1cb..3870852d2a 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -1467,10 +1467,6 @@ class Mapper(object): obj = self.class_.__new__(self.class_) obj._entity_name = self.entity_name - # this gets the AttributeManager to do some pre-initialization, - # in order to save on KeyErrors later on - attribute_manager.init_attr(obj) - return obj def _deferred_inheritance_condition(self, needs_tables):