← 输入框|github.com|刷新
Skip to content

Deprecate cross-type Version equality in semver 3 - #507

Merged
tomschr merged 2 commits into
masterfrom
506-hashes
Nov 14, 2026
Merged

tomschr merged 2 commits into
masterfrom
506-hashes

Conversation

@tomschr

@tomschr tomschr commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Relates to #506

Warn on equality with strings, tuples, and list while keeping Version hashable. Document mixed-key risks, semver 4 removal, and how to suppress this specific warning.

@agammann could you have a look? Thanks!

I'm a bit unsure about the warning. I hope people didn't use that too often, otherwise they would be flooded with warnings. On the other side, this will help to see it and it can't get unnoticed. 🤔

@tomschr tomschr self-assigned this Nov 4, 2026
@agammann

Copy link
Copy Markdown

I found a documentation issue at 0bf2a6d: the suggested warning filter uses strings or tuples, while the emitted warning says strings, tuples or lists, so the regex does not match and the documented suppression will not work. Could the filter and message be aligned and covered by a warning-filter test? The implementation also warns for list and bytes comparisons, which the documentation should account for. I checked the regex locally but did not run the project suite. AI-assisted review.

Relates to #506

Warn on equality with strings, tuples, and list while
keeping Version hashable. Document mixed-key risks,
semver 4 removal, and how to suppress this specific warning.
@tomschr

tomschr commented Nov 13, 2026 •

Copy link
Copy Markdown
Member Author

Thanks @agammann for your eagle eyes! Much appreciated! ❤️

I fixed it accordingly. Let me know if this looks good enough.

@agammann

Copy link
Copy Markdown

Thanks for the update. On 9fe08dd, I checked the documented filter against string, bytes, tuple and list comparisons: it suppresses the intended warning while an unrelated DeprecationWarning remains visible. The usage guide now covers all four types. I could not find a regression test for the filter, and the new changelog fragment still mentions only strings and tuples; could those be updated too? The filter check ran locally in Python 3.12. AI-assisted review.

* Update newsfragment file and mention strings, bytes, tuples, or lists
* Add additional test case test_should_filter_only_cross_type_equality_deprecation_warnings
  to check for a regression.
@tomschr

tomschr commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

Thank you @agammann, you are totally righ! I've addressed your issues in commit 87a5718. Anything else?

@agammann

Copy link
Copy Markdown

Thanks! On 87a5718, the changelog now mentions all four types, and the new regression checks that the documented filter suppresses the intended warnings while leaving an unrelated warning visible. I ran the two comparison test files offline in a Python 3.12 container: 108 passed (with expected deprecation warnings). I found nothing else in this focused recheck; I have not run the full project suite or documentation build. AI-assisted testing.

@tomschr

tomschr commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

Thanks @agammann for your checks. I've tested it and everything looks fine. 🎉 Merging to master.

Many thanks for your help! ❤️

@tomschr
tomschr merged commit e5f2c0f into master Nov 14, 2026
17 checks passed
@tomschr
tomschr deleted the 506-hashes branch November 14, 2026 16:21
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