You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I add a new conversion rule, it only applies when converting to Julia types T that have never had pyconvert(T, x) called on them.
julia>pyexec(""" class Hello: pass""", Main)
julia> x =pyeval("Hello()", Main)
Python:<Hello object at 0x14759a210>
julia>pyconvert(Any, x)
Python:<Hello object at 0x14759a210>
julia> t =pytype(x)
Python:<class 'Hello'>
julia> PythonCall.pyconvert_add_rule(pyconvert(Any, t.__module__)*":"*pyconvert(Any, t.__qualname__), String, (_, _) ->"Hello!!")
julia>pyconvert(Any, x)
Python:<Hello object at 0x14759a210>### BUG ### <===========================================
julia>pyconvert(String, x)
"Hello!!"
julia>empty!.(values(PythonCall.PYCONVERT_RULES_CACHE)) ### A possible fix ###2-element Vector{Dict{Ptr{PythonCall.C.PyObject}, Vector{Function}}}:Dict()
Dict()
julia>pyconvert(Any, x)
"Hello!!"
Your system
PythonCall v0.9.14
Possible fix
Make pyconvert_add_rule clear the rule cache
The text was updated successfully, but these errors were encountered:
Affects: PythonCall
Describe the bug
When I add a new conversion rule, it only applies when converting to Julia types
T
that have never hadpyconvert(T, x)
called on them.Your system
PythonCall v0.9.14
Possible fix
Make
pyconvert_add_rule
clear the rule cacheThe text was updated successfully, but these errors were encountered: