We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3af9170 commit 65ef689Copy full SHA for 65ef689
stdlib/Mmap/src/Mmap.jl
@@ -199,7 +199,7 @@ function mmap(io::IO,
199
overflow && throw(ArgumentError("requested size prod($((len, dims...))) too large, would overflow typeof(size(T)) == $(typeof(len))"))
200
end
201
len >= 0 || throw(ArgumentError("requested size must be ≥ 0, got $len"))
202
- len == 0 && return Array{T}(undef, ntuple(x->0,Val(N)))
+ len == 0 && return Array{T}(undef, dims)
203
len < typemax(Int) - PAGESIZE || throw(ArgumentError("requested size must be < $(typemax(Int)-PAGESIZE), got $len"))
204
205
offset >= 0 || throw(ArgumentError("requested offset must be ≥ 0, got $offset"))
stdlib/Mmap/test/runtests.jl
@@ -11,12 +11,13 @@ GC.gc(); GC.gc()
11
GC.gc(); GC.gc()
12
@test mmap(file, Array{UInt8,3}, (1,1,11)) == reshape(t,(1,1,11))
13
14
-@test mmap(file, Array{UInt8,3}, (11,0,1)) == Array{UInt8}(undef, (0,0,0))
+@test size(mmap(file, Array{UInt8,3}, (11,0,1))) == (11,0,1)
15
@test mmap(file, Vector{UInt8}, (11,)) == t
16
17
@test mmap(file, Array{UInt8,2}, (1,11)) == t'
18
19
-@test mmap(file, Array{UInt8,2}, (0,12)) == Array{UInt8}(undef, (0,0))
+@test size(mmap(file, Array{UInt8,2}, (0,12))) == (0,12)
20
+@test size(mmap(file, Matrix{Float32}, (10,0))) == (10,0)
21
m = mmap(file, Array{UInt8,3}, (1,2,1))
22
@test m == reshape(b"He",(1,2,1))
23
finalize(m); m=nothing; GC.gc()
0 commit comments