Skip to content

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

Merged
Liozou merged 1 commit into
coudertlab:masterfrom
adienes:fix-hash-method
Mar 20, 2026
Merged

Fix Base.hash to use only the two-arg method#26
Liozou merged 1 commit into
coudertlab:masterfrom
adienes:fix-hash-method

Conversation

@adienes
Copy link
Copy Markdown
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>
@Liozou Liozou merged commit 6b01477 into coudertlab:master Mar 20, 2026
4 checks passed
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 47.01%. Comparing base (f7079a3) to head (e56c6f7).
⚠️ Report is 108 commits behind head on master.

Files with missing lines Patch % Lines
src/Modulos.jl 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #26      +/-   ##
==========================================
- Coverage   53.67%   47.01%   -6.66%     
==========================================
  Files          16       16              
  Lines        5874     6423     +549     
==========================================
- Hits         3153     3020     -133     
- Misses       2721     3403     +682     

☔ 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.

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