PEP440Version.__hash__ inconsistent with __eq__ (1.0 == 1.0.0 but hashes differ)
PEP440Version.__hash__ is inconsistent with __eq__: equal versions hash differently.
__eq__ compares _norm_tuples(self._tup, rhs._tup) (trailing zeros are trimmed, so 1.0 == 1.0.0), but __hash__ is hash(self._tup) on the un-normalised tuple.
Verified against the Package Control 4.x package_control/pep440.py currently installed in Sublime Text 4 (also loaded standalone):
>>> a, b = PEP440Version('1.0'), PEP440Version('1.0.0')
>>> a == b, hash(a) == hash(b), len({a, b})
(True, False, 2)
Across 159 generated version strings (1, 1.0, 1.0.0, pre/post/dev/local/epoch combinations) there are 48 pairs where a == b but hash(a) != hash(b) (e.g. 1 vs 1.0, 1+local vs 1.0+local). Sets and dict keys of versions therefore treat equal versions as distinct. PackageVersion inherits this.
Fix: hash the normalised tuple, i.e. the same trimmed form __eq__ uses (hash(_trim_tuples(self._tup)) or equivalent).
For context, in the same differential test against packaging 26.2, version ordering, equality and str() normalisation matched the reference for all 159x159 pairs, so this is the only inconsistency I found in PEP440Version itself.
A concrete place where the inconsistent __hash__ has an effect: the release/tag listing dedupes with a set, if not version or version in used_versions: continue / used_versions.add(version) (github_client.py and gitlab_client.py, releases and tags), where version is a PackageVersion. Because PackageVersion('1.0') == PackageVersion('1.0.0') but their hashes differ, the second one is not recognised as a duplicate.
Reproduced in Sublime Text 4 (Package Control 4.2.8) with GitHubClient.download_info_from_releases() and fetch_json stubbed to return three releases, tagged v1.0.0, v1.0 and v2.0.0, each with a matching asset:
[('1.0.0', 'x-1.0.0.sublime-package'), ('1.0', 'x-1.0.sublime-package'), ('2.0.0', 'x-2.0.0.sublime-package')]
Both 1.0.0 and 1.0 are emitted although they are the same version, so the dedupe that this code path clearly intends doesn't work. Hashing the normalised tuple (as suggested above) fixes it.