JuliaPy / JuliaPy/PyCall.jl

strides is deprecated

オープン
#555 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Julia
スター
1.5k
フォーク
186
PR マージ指標
30日以内にマージされた PR はありません

説明

On 0.7, I can pass a reshaped range to PyCall

```
julia> np.sin(reshape(1:4, 2,2))
┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.
│ Specialize `strides(::Base.ReshapedArray)` if `Base.ReshapedArray` indeed uses a strided representation in memory.
│ Warning: inappropriately implementing this method for an array type that does not use strided
│ storage may lead to incorrect results or segfaults.
│ caller = stride at abstractarray.jl:350 [inlined]
└ @ Core ./abstractarray.jl:350
┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.
│ Specialize `strides(::Base.ReshapedArray)` if `Base.ReshapedArray` indeed uses a strided representation in memory.
│ Warning: inappropriately implementing this method for an array type that does not use strided
│ storage may lead to incorrect results or segfaults.
│ caller = stride at abstractarray.jl:350 [inlined]
└ @ Core ./abstractarray.jl:350
2×2 Array{Float64,2}:
0.841471 0.14112
0.909297 -0.756802
```

On 1.0, it's

```
ERROR: MethodError: no method matching strides(::Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}})
Closest candidates are:
strides(::SubArray) at subarray.jl:251
strides(::Base.CodeUnits) at strings/basic.jl:696
strides(::PermutedDimsArray{T,N,perm,iperm,AA} where AA<:AbstractArray where iperm) where {T, N, perm} at permuteddimsarray.jl:62
...
Stacktrace:
[1] stride(::Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}}, ::Int64) at ./abstractarray.jl:342
[2] array2py(::Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}}, ::Int64, ::Int64) at /home/cst-jean/.julia/packages/PyCall/rUul9/src/conversions.jl:305
[3] array2py(::Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}}) at /home/cst-jean/.julia/packages/PyCall/rUul9/src/conversions.jl:325
[4] Type at /home/cst-jean/.julia/packages/PyCall/rUul9/src/conversions.jl:327 [inlined]
[5] macro expansion at /home/cst-jean/.julia/packages/PyCall/rUul9/src/exception.jl:84 [inlined]
[6] _pycall!(::PyObject, ::PyObject, ::Tuple{Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}}}, ::Int64, ::Ptr{Nothing}) at /home/cst-jean/.julia/packages/PyCall/rUul9/src/pyfncall.jl:21
[7] #call#89 at /home/cst-jean/.julia/packages/PyCall/rUul9/src/pyfncall.jl:11 [inlined]
[8] (::PyObject)(::Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}}) at /home/cst-jean/.julia/packages/PyCall/rUul9/src/pyfncall.jl:89
```

Is that a PyCall issue, or a base issue?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Reproduce the reshaped-range conversion shown in the issue on Julia 1.0, then inspect src/conversions.jl around array2py and the reported stride call. Compare PyCall's conversion path with Julia's strides(::Base.ReshapedArray) behavior to establish which side owns the incompatibility. Done means the example no longer raises the reported MethodError.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
julia, numpy, python
領域
backend, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
28/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。