@@ -26,7 +26,7 @@ const PYJLVALUES = []
2626# unused indices in PYJLVALUES
2727const PYJLFREEVALUES = Int[]
2828# lock protecting PYJLVALUES and PYJLFREEVALUES from concurrent modification
29- const PYJL_LOCK = Threads. SpinLock ()
29+ # const PYJL_LOCK = Threads.SpinLock()
3030# set to true by an atexit hook so _pyjl_dealloc can skip Julia runtime calls
3131# (Base.GC.enable, lock) after jl_atexit_hook has torn down the runtime
3232const JL_EXITING = Ref (false )
@@ -49,10 +49,10 @@ function _pyjl_dealloc(o::C.PyPtr)
4949 # enqueue → Py_DecRef → _pyjl_dealloc → push! on same vector →
5050 # ConcurrencyViolationError). The lock guards against true multi-thread races.
5151 prev = Base. GC. enable (false )
52- lock (PYJL_LOCK)
52+ # lock(PYJL_LOCK)
5353 PYJLVALUES[idx] = nothing
5454 push! (PYJLFREEVALUES, idx)
55- unlock (PYJL_LOCK)
55+ # unlock(PYJL_LOCK)
5656 Base. GC. enable (prev)
5757 end
5858 (C. @ft UnsafePtr {PyJuliaValueObject} (o). weaklist[! ]) == C. PyNULL || C. PyObject_ClearWeakRefs (o)
@@ -394,15 +394,15 @@ PyJuliaValue_SetValue(_o, @nospecialize(v)) = Base.GC.@preserve _o begin
394394 # Disable GC to prevent push!/pop! from triggering a GC whose finalizers
395395 # re-entrantly resize the same vectors (see _pyjl_dealloc comment).
396396 prev = Base. GC. enable (false )
397- lock (PYJL_LOCK)
397+ # lock(PYJL_LOCK)
398398 if isempty (PYJLFREEVALUES)
399399 push! (PYJLVALUES, v)
400400 idx = length (PYJLVALUES)
401401 else
402402 idx = pop! (PYJLFREEVALUES)
403403 PYJLVALUES[idx] = v
404404 end
405- unlock (PYJL_LOCK)
405+ # unlock(PYJL_LOCK)
406406 Base. GC. enable (prev)
407407 C. @ft UnsafePtr {PyJuliaValueObject} (o). value[] = idx
408408 else
0 commit comments