Repository navigation
Fix hash segfault with PyCall 1.97 - #565
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PyCall 1.97 releases the GIL between calls, so the raw ccall to PyObject_Hash crashed on any Sym (e.g. `@syms c() a; Dict(c(0)=>a)`). Defer to PyCall's hash(::PyObject, ::UInt), which acquires the GIL, and require PyCall >= 1.97. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace deprecated actions/cache@v1 in ci-nightly with julia-actions/cache, bump all actions to current major versions, and add dependabot to keep GitHub Actions and Julia deps up to date. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
@syms c() a; Dict(c(0) => a)segfaults, as does hashing anySym(hash(a),Set,unique).hashis defined forSym, but it calledPyObject_Hashdirectly through a rawccall. PyCall 1.97 releases the GIL between calls and wraps its own C-API calls in@with_GIL. The raw call ran without the GIL and Python crashed inslot_tp_hash.Fix
hash(::PyObject, ::UInt), which acquires the GIL. The old method was a workaround until PyCall shipped a 2-arghash, and 1.97 has one.PyCallcompat to1.97(1.96.x only defines the 1-arghash).actions/cache@v1(now hard-failing) inci-nightly.ymlwithjulia-actions/cache, bump all actions to current majors, and add.github/dependabot.ymlfor GitHub Actions and Julia deps.CI note
On Julia 1.13 (the
1job), twotest-legacy.jltests in SymPyCore fail independently of this PR. They expect3 ^ [x 1]and3 ^ [x 1; 1 x]to throw aMethodError. In 1.13, LinearAlgebra's^(::Number, ::AbstractMatrix)callsexp(A)instead ofexp!, so the calls no longer throw. The fix belongs in SymPyCore, and this package's compat will pick up that release. The hash testset runs before the shared suite, so it still reports on 1.13.🤖 Generated with Claude Code