discard_init_args_on_class_path_change
does not handle nested dict
subclass specs in some contexts
#247
Labels
bug
Something isn't working
🐛 Bug report
Firstly, thanks again for all your work maintaining this remarkably valuable package!
While a
subclass_spec
can be either adict
orNamespace
jsonargparse/jsonargparse/typehints.py
Lines 790 to 795 in ac790ba
when entering
ActionTypeHint.discard_init_args_on_class_path_change
:jsonargparse/jsonargparse/typehints.py
Lines 295 to 310 in ac790ba
jsonargparse.typehints.discard_init_args_on_class_path_change
below currently assumes any previous value for a nested subclass will already have been cast as aNamespace
:jsonargparse/jsonargparse/typehints.py
Lines 934 to 942 in ac790ba
with
L941
resulting in:Right now, nested generic
dict
configurations like the repro case I include below don't trigger thesubclass_spec_as_namespace
Namespace
wrapping thatjsonargparse.typehints.discard_init_args_on_class_path_change
requires when removing overridden subclass spec configuration in this context.With the below minor patch to
jsonargparse.typehints.discard_init_args_on_class_path_change
, this use case can be accommodated (I haven't had a chance to run the full jsongarparse test suite but can't immediately think of any problem with this additional check/transformation):To reproduce
Current behavior:
Expected result, generated with additional handling discussed above:
Environment
pip install jsonargparse[all]
): pip install "jsonargparse[signatures]==4.20.0"The text was updated successfully, but these errors were encountered: