Closed jlbosse closed 2 months ago
Thanks, here's a reproducer for the underlying issue
julia> using PythonCall
julia> struct Struct3{T<:Number}
x::T
end
julia> function Base.show(io::IO, ::MIME"text/plain", t::Struct3{T}) where T
print(io, t.x)
end
julia> PythonCall.Utils.mimes_for(Struct3(5))
ERROR: TypeError: in Struct3, in T, expected T<:Number, got Type{Any}
Stacktrace:
[1] #s2#4
@ C:\Users\chris\.julia\dev\PythonCall\src\Utils\Utils.jl:106 [inlined]
[2] var"#s2#4"(T::Any, ::Any, ::Any)
@ PythonCall.Utils .\none:0
[3] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
@ Core .\boot.jl:602
[4] mimes_for(x::Any)
@ PythonCall.Utils C:\Users\chris\.julia\dev\PythonCall\src\Utils\Utils.jl:93
[5] top-level scope
@ REPL[3]:1
Affects: JuliaCall
Describe the bug
display
is broken for parametric structs whoseBase.show
references the type parameter. See the following three examples:In a ipython REPL (or jupyter notebook) with
juliacall
installed do the following:Your system Please provide detailed information about your system: