Skip to content

Support properties with generic setters #19298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

ilevkivskyi
Copy link
Member

This is yet another followup for checkmember work.

This handles a niche use case, but it is still used in the wild, and this restores parity between logic for descriptors with __set__() and properties with custom setters.

Copy link
Contributor

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

xarray (https://github.com/pydata/xarray)
- xarray/core/variable.py: note: In member "data" of class "Variable":
- xarray/core/variable.py:442: error: Incompatible override of a setter type  [override]
- xarray/core/variable.py:442: note:  (base class "NamedArray" defined the type as "_arrayfunction[Any, Any] | _arrayapi[Any, Any]",
- xarray/core/variable.py:442: note:  override has type "T_DuckArray | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | str | _NestedSequence[complex | bytes | str]")

@ilevkivskyi ilevkivskyi merged commit 28f0600 into python:master Jun 16, 2025
19 checks passed
@ilevkivskyi ilevkivskyi deleted the tricky-setters branch June 16, 2025 22:59
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.

2 participants