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

Fix (some) deprecation warnings #431

Merged
merged 5 commits into from
Jun 13, 2024
Merged

Fix (some) deprecation warnings #431

merged 5 commits into from
Jun 13, 2024

Conversation

Wuestengecko
Copy link
Member

No description provided.

Use the PEP-702 `@deprecated` decorator to mark deprecated methods and
classes where possible. This makes deprecation information available to
static type checkers like mypy.

This commit also adds the deprecation plugin from `mypypp` in order to
add early support for the feature to mypy.
This solves all static deprecation warnings discovered by the previous
commit, and wmultiple runtime-only warnings that have been around for a
while now.
Keeping instances of GenericElement and its subclasses hashable has
caused problems in the past, especially in the case of custom equality
operators. Those problems include ambiguity about what gets hashed, as
well as hashing over mutable attributes, which both can cause the object
in question to end up in an unexpected hash bucket in one way or
another, which in turn leads to extremely difficult to diagnose issues
downstream. This is why hashing is now deprecated for all elements.
Previously it was only deprecated for a limited number of object types,
where it was definitely known to cause problems; this change improves
consistency across the API and prevents unexpected TypeErrors if
unhashable objects suddenly end up in hashing contexts.
@Wuestengecko Wuestengecko merged commit ebcf9d5 into master Jun 13, 2024
9 checks passed
@Wuestengecko Wuestengecko deleted the deprecation-warnings branch June 13, 2024 09:45
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