Skip to content

Fix Base.hash to use only the two-arg method#602

Merged
stevengj merged 1 commit intoJuliaPy:masterfrom
adienes:fix-hash-method
Mar 19, 2026
Merged

Fix Base.hash to use only the two-arg method#602
stevengj merged 1 commit intoJuliaPy:masterfrom
adienes:fix-hash-method

Conversation

@adienes
Copy link
Contributor

@adienes adienes commented Mar 19, 2026

Generated as part of an ecosystem-wide audit for one-arg hash methods.

Base.hash should only be extended via the two-arg method hash(x, h::UInt).
Defining a one-arg hash(x) method, or giving the second argument a default
value, can lead to correctness bugs (hash contract violations when the seed
differs from the hard-coded default) and invalidation-related performance
issues. This is particularly necessary for Julia 1.13+ where the default hash
seed value will change.

This PR was generated with the assistance of generative AI.

Generated as part of an ecosystem-wide audit for one-arg hash methods.

`Base.hash` should only be extended via the two-arg method `hash(x, h::UInt)`.
Defining a one-arg `hash(x)` method, or giving the second argument a default
value, can lead to correctness bugs (hash contract violations when the seed
differs from the hard-coded default) and invalidation-related performance
issues. This is particularly necessary for Julia 1.13+ where the default hash
seed value will change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.09%. Comparing base (3c658d8) to head (e1dd060).

Files with missing lines Patch % Lines
src/PyPlot.jl 0.00% 1 Missing ⚠️
src/colormaps.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #602      +/-   ##
==========================================
- Coverage   22.31%   22.09%   -0.22%     
==========================================
  Files           4        4              
  Lines         363      362       -1     
==========================================
- Hits           81       80       -1     
  Misses        282      282              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stevengj stevengj merged commit 067372b into JuliaPy:master Mar 19, 2026
4 of 6 checks passed
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.

3 participants