Skip to content

Commit 1ce2749

Browse files
authored
fix PyNULL typo (#544)
* fix PyNULL typo * simplify PyObjectArray finalizer gc test --------- Co-authored-by: Christopher Doris <github.com/cjdoris>
1 parent 29dc91c commit 1ce2749

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: src/GC/GC.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function enqueue(ptr::C.PyPtr)
103103
end
104104

105105
function enqueue_all(ptrs)
106-
if any(!=(C.PYNULL), ptrs) && C.CTX.is_initialized
106+
if any(!=(C.PyNULL), ptrs) && C.CTX.is_initialized
107107
if C.PyGILState_Check() == 1
108108
for ptr in ptrs
109109
if ptr != C.PyNULL

Diff for: test/JlWrap.jl

+9
Original file line numberDiff line numberDiff line change
@@ -577,4 +577,13 @@ end
577577
@test pyeq(Bool, x.count(nothing), 0)
578578
@test pyeq(Bool, x.count("2"), 0)
579579
end
580+
581+
@testset "PyObjectArray" begin
582+
# https://github.com/JuliaPy/PythonCall.jl/issues/543
583+
# Here we check the finalizer does not error
584+
# We must not reuse `arr` in this code once we finalize it!
585+
let arr = PyObjectArray([1, 2, 3])
586+
finalize(arr)
587+
end
588+
end
580589
end

0 commit comments

Comments
 (0)