Fix CliPositionalArg[list[CustomType]] crash for custom types#839
Merged
Fix CliPositionalArg[list[CustomType]] crash for custom types#839
Conversation
…non-ValidationError exceptions The `_merged_list_to_str` method probes the inner list type by calling `validate_python(['1'])`, but only caught `StopIteration` and `ValidationError`. Custom type validators can raise arbitrary exceptions (e.g. plain `Exception`), causing a `SettingsError` instead of falling back gracefully. Widen the except clause to catch `Exception` since this is a type-probing heuristic where any failure should safely fall back to `is_num_type_str = None`. Fixes #823 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
8e74cd6 to
1a1dca8
Compare
Merged
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.
Summary
CliPositionalArg[list[CustomType]]crashing when the custom type's validator raises a non-ValidationErrorexception (e.g. plainException,ValueError,TypeError)_merged_list_to_strmethod probes the inner type by callingvalidate_python(['1'])— if this fails for any reason, the safe fallback isis_num_type_str = None. Widened theexceptclause from(StopIteration, ValidationError)toExceptionstrsubclass that raises plainExceptionFixes #823
Test plan
test_cli_variadic_positional_arg_custom_typepasses🤖 Generated with Claude Code