Skip to content

Widen fromstringlist sequence param to Iterable - #16840

Merged
srittau merged 1 commit into
python:mainfrom
chiliec:fromstringlist-iterable
Nov 16, 2026
Merged

srittau merged 1 commit into
python:mainfrom
chiliec:fromstringlist-iterable

Conversation

@chiliec

@chiliec chiliec commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

fromstringlist only iterates over its argument at runtime (for text in sequence), so a generator or any other iterable works. The stub required a Sequence, rejecting those calls. Changed the parameter to Iterable.

Fixes #16839.

Checked with tests/mypy_test.py stdlib/xml and tests/pyright_test.py (both clean).

The runtime only iterates over the argument, so a generator or any other
iterable works. Fixes python#16839.
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit 65fc0a7 into python:main Nov 16, 2026
88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xml.etree.ElementTree.fromstringlist should accept any iterable

2 participants