Skip to content

Commit 8c249a7

Browse files
Update src/a2a/utils/proto_utils.py
Co-authored-by: Holt Skinner <[email protected]>
1 parent 6c5a27d commit 8c249a7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/a2a/utils/proto_utils.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ def parse_string_integers_in_dict(value: Any, max_safe_digits: int = 15) -> Any:
118118
parse_string_integers_in_dict(item, max_safe_digits)
119119
for item in value
120120
]
121-
if (
122-
isinstance(value, str)
123-
and value.lstrip('-').isdigit()
124-
and len(value.lstrip('-')) > max_safe_digits
125-
):
126-
return int(value)
121+
if isinstance(value, str):
122+
# Handle potential negative numbers.
123+
stripped_value = value.lstrip('-')
124+
if stripped_value.isdigit() and len(stripped_value) > max_safe_digits:
125+
return int(value)
127126
return value
128127

129128

0 commit comments

Comments
 (0)