JuliaPy / JuliaPy/PyCall.jl

sympy matrices, and failed `pyerr_check`

Aperta
#736 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

After upgrading sympy to 1.5.1, I've noticed an error in sympy's `Matrix` constructor:

```
julia> using PyCall # [438e738f] PyCall v1.91.2
julia> sympy = PyCall.pyimport_conda("sympy", "sympy")
julia> sympy.__version__ # "1.5.1"
julia> sympy.Matrix([[1,1],[2,2]])
ERROR: PyError ($(Expr(:escape, :(ccall(#= /Users/verzani/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw)))))
ValueError('The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()')
File "/Users/verzani/.julia/conda/3/lib/python3.7/site-packages/sympy/matrices/dense.py", line 430, in __new__
return cls._new(*args, **kwargs)
File "/Users/verzani/.julia/conda/3/lib/python3.7/site-packages/sympy/matrices/dense.py", line 442, in _new
rows, cols, flat_list = cls._handle_creation_inputs(*args, **kwargs)
File "/Users/verzani/.julia/conda/3/lib/python3.7/site-packages/sympy/matrices/matrices.py", line 2623, in _handle_creation_inputs
if not row:

Stacktrace:
[1] pyerr_check at /Users/verzani/.julia/packages/PyCall/ttONZ/src/exception.jl:60 [inlined]
[2] pyerr_check at /Users/verzani/.julia/packages/PyCall/ttONZ/src/exception.jl:64 [inlined]
[3] macro expansion at /Users/verzani/.julia/packages/PyCall/ttONZ/src/exception.jl:84 [inlined]
[4] __pycall!(::PyObject, ::Ptr{PyCall.PyObject_struct}, ::PyObject, ::Ptr{Nothing}) at /Users/verzani/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:44
[5] _pycall!(::PyObject, ::PyObject, ::Tuple{Array{Array{Int64,1},1}}, ::Int64, ::Ptr{Nothing}) at /Users/verzani/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:29
[6] #_#111 at /Users/verzani/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:11 [inlined]
[7] (::PyObject)(::Array{Array{Int64,1},1}) at /Users/verzani/.julia/packages/PyCall/ttONZ/src/pyfncall.jl:89
[8] top-level scope at REPL[9]:1
```

Any chance this can be addressed from `PyCall`?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by running the Julia reproduction with PyCall v1.91.2 and SymPy 1.5.1, then inspect the stack frames in src/exception.jl and src/pyfncall.jl. Determine whether the failure is in PyCall's argument conversion or error handling; done means the Matrix call has a verified PyCall-side resolution or a clearly documented upstream limitation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
julia, python
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.