Skip to content

Support a small amount of generic converters for attrs - #22206

Open
A5rocks wants to merge 1 commit into
python:masterfrom
A5rocks:attrs-generic-converters
Open

A5rocks wants to merge 1 commit into
python:masterfrom
A5rocks:attrs-generic-converters

Conversation

@A5rocks

@A5rocks A5rocks commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

See #8625.

To be honest I don't see why we can't recurse on the converter return type along with the attribute type, and then set all the typevars we see based on the relevant part of the attribute type. I didn't do that since I don't know the right visitor to do so, but presumably I'm missing something that makes this harder?

@A5rocks A5rocks changed the title Support a small amount of #8625 Support a small amount of generic converters for attrs Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

core (https://github.com/home-assistant/core)
+ homeassistant/helpers/device_registry.py:1042: error: Unused "type: ignore" comment  [unused-ignore]
+ homeassistant/helpers/device_registry.py:2187: error: Unused "type: ignore" comment  [unused-ignore]
+ homeassistant/helpers/device_registry.py:4429: error: Unused "type: ignore" comment  [unused-ignore]

scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

@A5rocks

A5rocks commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@JukkaL what do you think of this approach? (TBH I don't know which operations are safe or not)

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.

1 participant