-
-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Description
So this code works as expected:
node = astroid.extract_node('''
def foo():
return 42
''')
print(list(node.infer_call_result(caller=node)))
$ python a.py
[<Const.int l.3 at 0x105704070>]
But this breaks:
node = astroid.extract_node('''
def with_metaclass(meta, *bases):
return 42
''')
print(list(node.infer_call_result(caller=node)))
$ python a.py
Traceback (most recent call last):
File "/Users/tusharsadhwani/a.py", line 14, in <module>
print(list(node.infer_call_result(node)))
File "/Users/tusharsadhwani/venv/lib/python3.10/site-packages/astroid/nodes/scoped_nodes/scoped_nodes.py", line 1738, in infer_call_result
metaclass = next(caller.args[0].infer(context), None)
TypeError: 'Arguments' object is not subscriptable
astroid seems to have special handling for functions called with_metaclass
, which seems to be broken.
Am I using the method wrongly? I tried using it just as I saw it being used in the project itself.