Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write fails for non-strided SubArrays #27951

Closed
timholy opened this issue Jul 5, 2018 · 1 comment
Closed

write fails for non-strided SubArrays #27951

timholy opened this issue Jul 5, 2018 · 1 comment
Labels
domain:arrays [a, r, r, a, y, s] domain:io Involving the I/O subsystem: libuv, read, write, etc. kind:bug Indicates an unexpected problem or unintended behavior

Comments

@timholy
Copy link
Sponsor Member

timholy commented Jul 5, 2018

julia> a = rand(5,5,5);

julia> v = view(a, 1:2:5, [1,4], :);

julia> open("/tmp/test.bin", "w") do io
           write(io, v)
       end
ERROR: ArgumentError: strides is invalid for SubArrays with indices of type Array{Int64,1}
Stacktrace:
 [1] write(::IOStream, ::SubArray{Float64,3,Array{Float64,3},Tuple{StepRange{Int64,Int64},Array{Int64,1},Base.Slice{Base.OneTo{Int64}}},false}) at ./subarray.jl:258
 [2] (::getfield(Main, Symbol("##5#6")))(::IOStream) at ./REPL[4]:2
 [3] #open#301(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(Main, Symbol("##5#6")), ::String, ::Vararg{String,N} where N) at ./iostream.jl:369
 [4] open(::Function, ::String, ::String) at ./iostream.jl:367
 [5] top-level scope at none:0
@JeffBezanson JeffBezanson added kind:bug Indicates an unexpected problem or unintended behavior domain:io Involving the I/O subsystem: libuv, read, write, etc. domain:arrays [a, r, r, a, y, s] labels Jul 6, 2018
@JeffBezanson
Copy link
Sponsor Member

I also notice the stack trace is wrong; that write method is not in subarray.jl, and it's missing the inlined frames that are in subarray.jl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:arrays [a, r, r, a, y, s] domain:io Involving the I/O subsystem: libuv, read, write, etc. kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants