Ignore super calls when super class cannot be inferred

This commit is contained in:
Jean Cavallo
2019-06-12 09:51:08 +02:00
parent ed092e6da7
commit a3afdc0ece
2 changed files with 17 additions and 0 deletions

View File

@@ -243,6 +243,9 @@ def builtins_super(types, objects, context):
if isinstance(context, FunctionExecutionContext):
if isinstance(context.var_args, InstanceArguments):
su = context.var_args.instance.py__class__().py__bases__()
# If super class cannot be infered
if len(su) == 0:
return NO_CONTEXTS
return su[0].infer().execute_evaluated()
return NO_CONTEXTS

View File

@@ -276,3 +276,17 @@ qsplit = shlex.split("foo, ferwerwerw werw werw e")
for part in qsplit:
#? str()
part
# -----------------
# Unknown metaclass
# -----------------
# Github issue 1321
class Meta(object):
pass
class Test(metaclass=Meta):
def test_function(self):
result = super(Test, self).test_function()
#? []
result.