{{ message }}
Repository navigation
Conversation
…rser
parse_list and parse_dict unconditionally indexed get_args(annotation),
so any unparameterized collection annotation crashed the CLI parser:
- def f(tags: list) + tags=[1, 2, 3] raised ListParseError
('tuple index out of range')
- def f(mapping: dict) + mapping={'a': 1} raised DictParseError
('not enough values to unpack')
- Optional[list]/Optional[dict] failed the same way through parse_union
- Union[list, str] silently fell through to str and returned the raw
string '[1, 2]' instead of a list
- bare typing.List/typing.Dict additionally crashed in
_maybe_resolve_annotation when rebuilding the generic from an empty
args tuple
Unparameterized annotations now fall back to untyped literal parsing,
and _maybe_resolve_annotation returns them unchanged.
Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
ManoharPaturi
force-pushed
the
fix/type-parser-unparameterized-list-dict
branch
from
September 7, 2026 16:36
84c1a8f to
5f1bc0b
Compare
Contributor
ko3n1g
approved these changes
Oct 2, 2026
ko3n1g
enabled auto-merge (squash)
October 2, 2026 16:21
ManoharPaturi
added a commit
to ManoharPaturi/Run
that referenced
this pull request
Oct 2, 2026
Resolve the cli_parser conflict by keeping this branch's resolver helpers (_get_type_checking_imports, _resolve_string_annotation) and folding main's NVIDIA-NeMo#607 unparameterized-generics early return into _maybe_resolve_annotation. Also address the review finding on forward references: a quoted name under future annotations ("'Path'") evaluates to another string, and container annotations like list["Path"] evaluate to generics holding unresolved ForwardRefs. _resolve_string_annotation now feeds its evaluated result back through _maybe_resolve_annotation (depth capped) instead of stopping after one evaluation, and Literal args are skipped by the recursion so Literal["Path"] keeps its string values. Added regressions for the real future-annotations module, nested forward refs, Literal preservation, and class-based configs.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #606.
parse_list/parse_dictnow checkget_args(annotation)and return the literal-evaluated collection when the annotation has no type arguments (nothing to coerce to)._maybe_resolve_annotationreturns unparameterized generics as-is instead of rebuildingList[...]from an empty args tuple.That fixes the crash for
x: list/x: dict, theOptional[list]Union crash, baretyping.List, and the silentUnion[list, str] → '[1, 2]'string misparse.Tests: 5 new, all fail on main, pass here;
test/cli/test_cli_parser.pyfully green (85 passed).