Skip to content

fix: preserve falsy primitive args in Config/Partial binding#566

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/config-arg-truthiness
Open

fix: preserve falsy primitive args in Config/Partial binding#566
andrewwhitecdw wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
andrewwhitecdw:andrewwhitecdw/fix/config-arg-truthiness

Conversation

@andrewwhitecdw

Copy link
Copy Markdown

Bug

_construct_args used if arg: to decide whether to copy a keyword argument, which treated 0, False, and "" as missing.

Fix

Use if arg is not None: so legitimate falsy values are preserved during binding.

Test

Added TestPartial::test_falsy_primitive_args_are_preserved, which verifies that 0, False, and empty-string args survive run.Partial construction and fdl.build.

Verification

uv run pytest test/test_config.py::TestPartial::test_falsy_primitive_args_are_preserved -v passes.
uv run --group lint ruff check nemo_run/config.py test/test_config.py and ruff format --check ... pass.

_construct_args used  to decide whether to copy a keyword

argument, which treated 0, False, and '' as missing. Use

so legitimate falsy values are preserved during binding.

Adds a regression test verifying that 0, False, and empty string args

survive Partial construction and build.

Signed-off-by: Andrew White <andrewh@cdw.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant