JuliaPy / JuliaPy/PythonCall.jl
Single-index access to matrix results in confusing error
- 主要言語
- Julia
- スター
- 1.1k
- フォーク
- 86
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 3
説明
**Affects:** JuliaCall
**Describe the bug**
```
from juliacall import Main as jl
z = jl.seval("[0 1; 2 3]")
z[0]
```
results in the stack trace
```
File ~/.julia/packages/PythonCall/wXfah/src/jlwrap/array.jl:310, in __getitem__(self, k)
308 return bool(len(self))
309 def __getitem__(self, k):
--> 310 return self._jl_callmethod($(pyjl_methodnum(pyjlarray_getitem)), k)
311 def __setitem__(self, k, v):
312 self._jl_callmethod($(pyjl_methodnum(pyjlarray_setitem)), k, v)
JuliaError: "an error occurred while setting an error"
```
I would expect `z[0]` to have the same output as `list(z)[0]`. The latter outputs just `0`. Fair enough if you want to choose a different semantics though, since `z[0,:]` is another reasonable choice. Regardless, the error message is confusing as it stands.
**Your system**
- macos 13.6
- python 3.11.4
- julia 1.9.4
- juliacall 0.9.15
JuliaPkg Status
/Users/pcrein/.pyenv/versions/3.11.4/envs/pyqsr-3.11.4/julia_env/pyjuliapkg/juliapkg.json (empty project)
Julia 1.9.4 @ /Users/pcrein/.julia/juliaup/julia-1.9.4+0.aarch64.apple.darwin14/bin/julia
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Reproduce the matrix access example and start at src/jlwrap/array.jl:310, where __getitem__ is shown in the stack trace. Compare z[0] with list(z)[0] and z[0,:] to establish the intended indexing behavior; done means the chosen behavior is consistent and no longer produces the confusing error message.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- julia, python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100