]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- plug a minor ORM speed hit in Events (**kwargs).
authorGaëtan de Menten <ged@openhex.org>
Sun, 7 Mar 2010 19:45:39 +0000 (20:45 +0100)
committerGaëtan de Menten <ged@openhex.org>
Sun, 7 Mar 2010 19:45:39 +0000 (20:45 +0100)
- added comment explaining some strange code

lib/sqlalchemy/orm/attributes.py

index a51a94e5c9780d782a2ea3d6cebd26c187148226..eff7d65cbeb4125134e40ba6f97e6d6f642fb05c 100644 (file)
@@ -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