-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorgood first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to JuliaiterationInvolves iteration or the iteration protocolInvolves iteration or the iteration protocol
Description
When zipping with a product iterator with no arguments (which produces only one output, the empty tuple), it seems the check for zip completion does not handle this case:
julia> for (z,) in zip(Iterators.product())
@show z
end
z = ()
ERROR: ArgumentError: tuple must be non-empty
Stacktrace:
[1] first(#unused#::Tuple{})
@ Base ./tuple.jl:140
[2] _pisdone
@ ./iterators.jl:1005 [inlined]
[3] isdone
@ ./iterators.jl:1012 [inlined]
[4] _zip_isdone(is::Tuple{Base.Iterators.ProductIterator{Tuple{}}}, ss::Tuple{Tuple{Bool}})
@ Base.Iterators ./iterators.jl:379
[5] _zip_iterate_all
@ ./iterators.jl:348 [inlined]
[6] iterate
@ ./iterators.jl:341 [inlined]
[7] top-level scope
@ ./REPL[79]:2
versioninfo()
output:
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 4
JULIA_EDITOR = vim
EDIT: zip([()])
works fine though:
julia> for (z,) in zip([()])
@show z
end
z = ()
julia>
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorgood first issueIndicates a good issue for first-time contributors to JuliaIndicates a good issue for first-time contributors to JuliaiterationInvolves iteration or the iteration protocolInvolves iteration or the iteration protocol