anthropic-sdk-python
anthropic-sdk-python copied to clipboard
Fix construct_type() crash on bare list/dict types
Summary
\construct_type()\ crashes when given bare generic types (without type parameters):
- bare \list\ → \IndexError\ at \rgs[0]\
- bare \dict\ → \ValueError\ at _, items_type = get_args(type_)\
Fix
Both branches now guard against missing type arguments and return the value unchanged.
- \dict\ branch: guard with \if len(args_tuple) < 2: return value\
- \list\ branch: guard with \if not args: return value\
Fixes #1626. Fixes #1619.