Skip to content

Commit 2c2c95a

Browse files
author
Christopher Doris
committed
double-check the cache
1 parent 28ea9d1 commit 2c2c95a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/JlWrap/C.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function _pyjl_callmethod(o::C.PyPtr, args::C.PyPtr)
6464
end
6565

6666
const PYJLBUFCACHE = Dict{Ptr{Cvoid},Any}()
67+
const PYJLBUFCACHE_DEBUG = []
6768

6869
@kwdef struct PyBufferInfo{N}
6970
# data
@@ -177,7 +178,9 @@ function _pyjl_get_buffer_impl(
177178

178179
# internal
179180
cptr = Base.pointer_from_objref(c)
181+
@assert !haskey(PYJLBUFCACHE, cptr)
180182
PYJLBUFCACHE[cptr] = c
183+
push!(PYJLBUFCACHE_DEBUG, c)
181184
b.internal[] = cptr
182185

183186
# obj

0 commit comments

Comments
 (0)