getindex(::PyObject, ::Union{Symbol, AbstractString}) should not call getproperty
- 主要言語
- Julia
- スター
- 1.5k
- フォーク
- 186
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Sometimes the Python object that underlies your PyObject needs to be accessed with a slice-like notation with a string rather than dot notation. `dict`s would be one example, but since they're converted to Julia `Dict`s, they don't really highlight the issue. Here is where I'm running into it. Unfortunately I don't have a better example than this (this one requires having MATLAB installed to run):
```julia
julia> using PyCall
```
```julia
julia> py"""
import matlab.engine
eng = matlab.engine.start_matlab()
"""
```
```julia
julia> eng = py"eng"
PyObject
```
```julia
julia> py"""
eng.workspace['a'] = 0.0
"""
```
```julia
julia> eng.workspace
Name Size Bytes Class Attributes
a 1x1 8 double
PyObject
```
```julia
julia> eng.workspace["a"]
ERROR: KeyError: key "a" not found
...
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start by locating the getindex(::PyObject, ::Union{Symbol, AbstractString}) implementation and reproduce the reported eng.workspace["a"] failure if MATLAB is available. Done means string indexing accesses the underlying Python object correctly instead of following getproperty and no longer raises KeyError for the shown example.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- julia, python
- 領域
- backend-api-design
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100