You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently (v4.12.0) the AST resolver fails when resolving calls to super that don't follow the immediate MRO (i.e., super(SubClass, self) for class SubSubClass(SubClass)). This used to be possible in <=v4.9.0, so would it be possible for AST resolver to handle these cases?
which is a valid initialisation for SubSubClass, though sub_kwarg isn't necessary.
In v4.12.0 (with JSONARGPARSE_DEBUG enabled), however, it results in an error:
...
2022-07-27 11:59:33,895 - ArgumentParser - DEBUG - AST resolver: super with arbitrary parameters not supported: Call(func=Attribute(value=Call(func=Name(id='super', ctx=Load()), args=[Name(id='SubClass', ctx=Load()), Name(id='self', ctx=Load())], keywords=[]), attr='__init__', ctx=Load()), args=[Starred(value=Name(id='args', ctx=Load()), ctx=Load())], keywords=[keyword(arg=None, value=Name(id='kwargs', ctx=Load()))])
2022-07-27 11:59:33,902 - ArgumentParser - ERROR - 'Configuration check failed :: No action for destination key "base_arg" to check its value.'
2022-07-27 11:59:33,906 - ArgumentParser - ERROR - Parser key "myclass": Problem with given class_path "__main__.SubSubClass":
...
Expected behavior
If possible, I would expect the previous script to produce:
Thank you for reporting. In v4.9.0 the fact that sub_kwarg is in the namespace is not just about being unnecessary. If BaseClass didn't have **kwargs, it would fail on instantiation, i.e.
Super with arbitrary parameters wasn't supported in v4.9.0 and it isn't supported in v4.12.0. This isn't really a bug, but a feature request. Changing the labels accordingly.
🚀 Feature request
Currently (
v4.12.0
) the AST resolver fails when resolving calls to super that don't follow the immediate MRO (i.e.,super(SubClass, self)
for classSubSubClass(SubClass)
). This used to be possible in<=v4.9.0
, so would it be possible for AST resolver to handle these cases?To reproduce
Running the script in
v4.9.0
results in:which is a valid initialisation for
SubSubClass
, thoughsub_kwarg
isn't necessary.In
v4.12.0
(withJSONARGPARSE_DEBUG
enabled), however, it results in an error:Expected behavior
If possible, I would expect the previous script to produce:
Environment
pip install jsonargparse
Thank you in advance!
The text was updated successfully, but these errors were encountered: