]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
merge default
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 May 2013 17:02:33 +0000 (13:02 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 23 May 2013 17:02:33 +0000 (13:02 -0400)
1  2 
lib/sqlalchemy/util/langhelpers.py
test/base/test_utils.py

index 4cb745c2bacffdbc14556da2a7a542de0275a45d,d82aefdeae7d67f27cec863804540b9b442863d4..b0ff5b0738be3e85ec96b2e37308e94a310cd5db
@@@ -160,33 -162,31 +160,31 @@@ def get_cls_kwargs(cls, _set=None)
      No anonymous tuple arguments please !
  
      """
+     toplevel = _set == None
+     if toplevel:
+         _set = set()
  
-     for c in cls.__mro__:
-         if '__init__' in c.__dict__:
-             stack = set([c])
-             break
-     else:
-         return []
-     args = set()
-     while stack:
-         class_ = stack.pop()
-         ctr = class_.__dict__.get('__init__', False)
-         if (not ctr or
-             not isinstance(ctr, types.FunctionType) or
-                 not isinstance(ctr.__code__, types.CodeType)):
-             stack.update(class_.__bases__)
-             continue
-         # this is shorthand for
-         # names, _, has_kw, _ = inspect.getargspec(ctr)
+     ctr = cls.__dict__.get('__init__', False)
  
 -        isinstance(ctr.func_code, types.CodeType)
+     has_init = ctr and isinstance(ctr, types.FunctionType) and \
++        isinstance(ctr.__code__, types.CodeType)
+     if has_init:
          names, has_kw = inspect_func_args(ctr)
-         args.update(names)
-         if has_kw:
-             stack.update(class_.__bases__)
-     args.discard('self')
-     return args
+         _set.update(names)
+         if not has_kw and not toplevel:
+             return None
+     if not has_init or has_kw:
+         for c in cls.__bases__:
+             if get_cls_kwargs(c, _set) is None:
+                 break
+     _set.discard('self')
+     return _set
  
  try:
      from inspect import CO_VARKEYWORDS
Simple merge