JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.45k stars 186 forks source link

PyCall.PyJlError has no field T #1020

Closed lgeissbauer-btig closed 1 year ago

lgeissbauer-btig commented 1 year ago
julia> PyCall

julia> JET

julia> function f(py_object::PyCall.PyObject)
           py_object.to_eng_string()
       end
f (generic function with 1 method)

julia> JET.@report_call f(PyCall.PyObject(UInt128(1)))
═════ 1 possible error found ═════
┌ @ REPL[12]:2 py_object.to_eng_string
│┌ @ C:\.julia\packages\PyCall\9Nvls\src\PyCall.jl:318 PyCall.__getproperty(o, s)
││┌ @ C:\.julia\packages\PyCall\9Nvls\src\PyCall.jl:312 p = PyCall._getproperty(o, s)
│││┌ @ C:\.julia\packages\PyCall\9Nvls\src\PyCall.jl:303 e.T
││││┌ @ Base.jl:38 Base.getfield(x, f)
│││││ type PyCall.PyJlError has no field T
││││└──────────────

https://github.com/aviatesk/JET.jl/issues/449

stevengj commented 1 year ago

Similar to #1021, this is JET complaining about the type instability of pyerror, but it should be safe in this context.