Skip to content

fix: convert iterators to list in t_contents to avoid confusing errors - #3212

Open
yashdhumane wants to merge 1 commit into
googleapis:mainfrom
yashdhumane:fix/t-contents-iterator-support
Open

yashdhumane wants to merge 1 commit into
googleapis:mainfrom
yashdhumane:fix/t-contents-iterator-support

Conversation

@yashdhumane

Copy link
Copy Markdown

Passing a reversed() iterator or any non-list iterable to generate_content caused confusing errors like 'contents are required' or 'file uri and mime_type are required' instead of a clear message.

Fix converts iterables (generators, reversed, map, etc.) to a list before validation, so they work correctly.

Fixes #1272

Passing a reversed() iterator or any non-list iterable to generate_content
caused confusing errors like 'contents are required' or 'file uri and
mime_type are required' instead of a clear message.

Fix converts iterables (generators, reversed, map, etc.) to a list
before validation, so they work correctly.

Fixes googleapis#1272
@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Oct 26, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:S Code changes < 10 lines label Oct 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S Code changes < 10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unrelated error shown when trying to use a reversed content list

2 participants