Closed
Description
It seems like #36405, included in Julia 1.5-rc1, broke write
for multidimensional SubArray
s:
julia> x = rand(10, 10);
julia> v = @view x[1:3, 1:3];
julia> write(stdout, v)
ERROR: MethodError: no method matching pointer(::SubArray{Float64,2,Array{Float64,2},Tuple{UnitRange{Int64},UnitRange{Int64}},false}, ::Tuple{Int64,Int64})
Closest candidates are:
pointer(::AbstractArray{T,N} where N) where T at abstractarray.jl:1002
pointer(::AbstractArray{T,N} where N, ::Integer) where T at abstractarray.jl:1003
Stacktrace:
[1] write(::Base.TTY, ::SubArray{Float64,2,Array{Float64,2},Tuple{UnitRange{Int64},UnitRange{Int64}},false}) at ./io.jl:666
[2] top-level scope at REPL[25]:1
This works as expected on Julia 1.4.2.
The problem is in the write
function for SubArray
, which calls pointer(::SubArray, ::Tuple{Vararg{Int}})
with a tuple of indices. This variant of pointer
was removed in #36405.
Version info:
Julia Version 1.5.0-rc1.0
Commit 24f033c951* (2020-06-26 20:13 UTC)
Platform Info:
OS: Linux (x86_64-redhat-linux)
CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_HDF5_LIBRARY_PATH = /usr/lib64/mpich/lib
JULIA_PKG_SERVER = pkg.julialang.org