Skip to content

Commit 1d38a4f

Browse files
work around nothing passing to cfunction
1 parent 8493ed3 commit 1d38a4f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ function vars!(vars, O)
9393
end
9494

9595
@inline @generated function fast_invokelatest(f, ::Type{rt}, args...) where rt
96-
tupargs = Expr(:tuple,args...)
96+
tupargs = Expr(:tuple,(a==Nothing ? Int : a for a in args)...)
9797
quote
98-
_f = $(Expr(:cfunction, Base.CFunction, :f, rt, :((Core.svec)($args...)), :(:ccall)))
99-
return ccall(_f.ptr,rt,$tupargs,$((:(getindex(args,$i)) for i in 1:length(args))...))
98+
_f = $(Expr(:cfunction, Base.CFunction, :f, rt, :((Core.svec)($((a==Nothing ? Int : a for a in args)...))), :(:ccall)))
99+
return ccall(_f.ptr,rt,$tupargs,$((:(getindex(args,$i) === nothing ? 0 : getindex(args,$i)) for i in 1:length(args))...))
100100
end
101101
end

0 commit comments

Comments
 (0)