summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaëtan de Menten <ged@openhex.org>2010-03-07 20:45:39 +0100
committerGaëtan de Menten <ged@openhex.org>2010-03-07 20:45:39 +0100
commit2b83b380023064a89b2f9ffdd0afad4fa942bdc7 (patch)
tree899cbdc6ce8457f87f331e8c2e5110b71f80b7c1
parent6f1425d04ace2bbe41ae426c726bfd81f26b6174 (diff)
downloadsqlalchemy-2b83b380023064a89b2f9ffdd0afad4fa942bdc7.tar.gz
- plug a minor ORM speed hit in Events (**kwargs).
- added comment explaining some strange code
-rw-r--r--lib/sqlalchemy/orm/attributes.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index a51a94e5c..eff7d65cb 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -883,14 +883,16 @@ class GenericBackrefExtension(interfaces.AttributeExtension):
class Events(object):
def __init__(self):
self.original_init = object.__init__
+ # Initialize to tuples instead of lists to minimize the memory
+ # footprint
self.on_init = ()
self.on_init_failure = ()
self.on_load = ()
self.on_resurrect = ()
- def run(self, event, *args, **kwargs):
+ def run(self, event, *args):
for fn in getattr(self, event):
- fn(*args, **kwargs)
+ fn(*args)
def add_listener(self, event, listener):
# not thread safe... problem? mb: nope