Skip to content

IPython crash when error occurs after import tyjuliacall julia module #3

@songjhaha

Description

@songjhaha

Python's original repl works fine

In [1]: from tyjuliacall import Main

In [2]: Main.eval(Main.Meta.parse("struct Point x end"))

In [3]: a = Main.Point(1)

In [4]: a*a # try to
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
  File "/home/songjhaha/miniconda3/envs/dev/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-ac686954dc0d>", line 1, in <module>
    a*a
  File "/home/songjhaha/miniconda3/envs/dev/lib/python3.7/site-packages/tyjuliasetup/jv.py", line 64, in __mul__
    return __jl_mul__(self, other)
RuntimeError: MethodError: no method matching length(::Point)
Closest candidates are:
  length(!Matched::Union{Base.KeySet, Base.ValueIterator}) at ~/.jnumpy/julias/julia-1.7/share/julia/base/abstractdict.jl:58
  length(!Matched::Union{LinearAlgebra.Adjoint{T, S}, LinearAlgebra.Transpose{T, S}} where {T, S}) at ~/.jnumpy/julias/julia-1.7/share/julia/stdlib/v1.7/LinearAlgebra/src/adjtrans.jl:171
  length(!Matched::Base.InvasiveLinkedListSynchronized) at ~/.jnumpy/julias/julia-1.7/share/julia/base/task.jl:604
  ...
Stacktrace:
 [1] _similar_shape(itr::Point, #unused#::Base.HasLength)
   @ Base ./array.jl:600
 [2] _collect(cont::UnitRange{Int64}, itr::Point, #unused#::Base.HasEltype, isz::Base.HasLength)
   @ Base ./array.jl:655
 [3] collect(itr::Point)
   @ Base ./array.jl:649
 [4] broadcastable(x::Point)
   @ Base.Broadcast ./broadcast.jl:704
 [5] broadcasted(::Function, ::Point, ::Point)
   @ Base.Broadcast ./broadcast.jl:1300
 [6] jl_mul(self::TyPython.CPython.Py, other::TyPython.CPython.Py)
   @ TyJuliaSetup ~/miniconda3/envs/dev/lib/python3.7/site-packages/tyjuliasetup/src/TyJuliaSetup.jl:320
 [7] jl_mul(self::Ptr{TyPython.CPython.PyObject}, _vectorargs::Ptr{TyPython.C.Ptr{TyPython.CPython.PyObject}}, argc::Int64)
   @ TyJuliaSetup ~/miniconda3/envs/dev/lib/python3.7/site-packages/jnumpy/TyPython/src/CPython.Dev.jl:90
 [8] jl_mul(self::Ptr{TyPython.CPython.PyObject}, _vectorargs::Ptr{TyPython.C.Ptr{TyPython.CPython.PyObject}}, argc::Int64)
   @ TyJuliaSetup ~/miniconda3/envs/dev/lib/python3.7/site-packages/jnumpy/TyPython/src/CPython.Dev.jl:111

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/songjhaha/miniconda3/envs/dev/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2099, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'RuntimeError' object has no attribute '_render_traceback_'
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions