Skip to content

Commit

Permalink
fix PyNULL typo (#544)
Browse files Browse the repository at this point in the history
* fix PyNULL typo

* simplify PyObjectArray finalizer gc test

---------

Co-authored-by: Christopher Doris <github.com/cjdoris>
  • Loading branch information
ericphanson authored Aug 22, 2024
1 parent 29dc91c commit 1ce2749
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/GC/GC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function enqueue(ptr::C.PyPtr)
end

function enqueue_all(ptrs)
if any(!=(C.PYNULL), ptrs) && C.CTX.is_initialized
if any(!=(C.PyNULL), ptrs) && C.CTX.is_initialized
if C.PyGILState_Check() == 1
for ptr in ptrs
if ptr != C.PyNULL
Expand Down
9 changes: 9 additions & 0 deletions test/JlWrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,13 @@ end
@test pyeq(Bool, x.count(nothing), 0)
@test pyeq(Bool, x.count("2"), 0)
end

@testset "PyObjectArray" begin
# https://github.com/JuliaPy/PythonCall.jl/issues/543
# Here we check the finalizer does not error
# We must not reuse `arr` in this code once we finalize it!
let arr = PyObjectArray([1, 2, 3])
finalize(arr)
end
end
end

0 comments on commit 1ce2749

Please sign in to comment.