Skip to content
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

improve annotations for methods returning copies #1880

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

viccie30
Copy link
Contributor

These methods always return a new object of the same type as the object they are bound to, even if this is a subclass. Change the annotations to reflect that.

I have not opened an issue, because it's not a functional bug. It just causes issues with static type checkers.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change. (N/A)
  • Add or update relevant docs, in the docs folder and in code. (N/A)
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs. (N/A)
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@viccie30
Copy link
Contributor Author

The pre-commit failure is not related to the changes in the PR and also happens with the current state of the branch.

@davidism davidism added this to the 3.1.5 milestone Dec 20, 2024
@davidism davidism force-pushed the fix-self-return-type branch from 3ab700a to f6b497e Compare December 20, 2024 04:22
@davidism davidism closed this Dec 20, 2024
@davidism davidism reopened this Dec 20, 2024
@davidism davidism force-pushed the fix-self-return-type branch from f6b497e to ded9915 Compare December 20, 2024 04:27
@davidism davidism changed the title Fix return value annotations for methods returning copies improve annotations for methods returning copies Dec 20, 2024
@davidism davidism merged commit 106d61c into pallets:stable Dec 20, 2024
12 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants