-
Notifications
You must be signed in to change notification settings - Fork 189
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
add 2-arg hash function #1054
add 2-arg hash function #1054
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1054 +/- ##
==========================================
+ Coverage 67.75% 67.78% +0.03%
==========================================
Files 20 20
Lines 2025 2024 -1
==========================================
Hits 1372 1372
+ Misses 653 652 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
src/PyCall.jl
Outdated
@@ -273,20 +273,20 @@ end | |||
const pysalt = hash("PyCall.PyObject") # "salt" to mix in to PyObject hashes | |||
hashsalt(x) = hash(x, pysalt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just delete this function (also from src/precompile.jl
).
LGTM. I agree about removing I can't remember why I did it this way — may be from quite an old Julia version. |
Thanks! Let me know if there is anything else to be done here. |
@stevengj would it be possible to merge this? Thanks! - Miles |
On discourse (https://discourse.julialang.org/t/sympy-sym-s-as-keys-in-dicts/103995) the issue of using tuples of symbolic keys let to the realization that the 2 argument form of
hash
resolved to a different code path than the 1-argument form. This consolidates the two.If this PR is reasonable, it might also make sense to remove the precompile statement for
hashsalt
and thehashsalt
function.The approach taken in
PythonCall
might provide an alternative. (Base.hash(x::Py, h::UInt) = reinterpret(UInt, Int(pyhash(x))) - 3h
)