Skip to content

Commit 82f7f4a

Browse files
committed
avoid generated function caching
1 parent 53a8e80 commit 82f7f4a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Convert/pyconvert.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,14 @@ end
307307

308308
pyconvert_fix(::Type{T}, func) where {T} = x -> func(T, x)
309309

310-
const PYCONVERT_RULES_CACHE = Lockable(Dict{Type,Dict{C.PyPtr,Vector{Function}}}())
310+
const PYCONVERT_RULES_CACHE = Lockable(IdDict{Any,Dict{C.PyPtr,Vector{Function}}}())
311311

312312
function pyconvert_rules_cache(::Type{T}) where {T}
313-
Base.@lock PYCONVERT_RULES_CACHE _pyconvert_rules_cache!(T)
314-
end
315-
@generated function _pyconvert_rules_cache!(::Type{T}) where {T}
316-
get!(Dict{C.PyPtr,Vector{Function}}, PYCONVERT_RULES_CACHE[], T)
313+
Base.@lock PYCONVERT_RULES_CACHE get!(
314+
Dict{C.PyPtr,Vector{Function}},
315+
PYCONVERT_RULES_CACHE[],
316+
T,
317+
)
317318
end
318319

319320
function pyconvert_rule_fast(::Type{T}, x::Py) where {T}

0 commit comments

Comments
 (0)