Open
Description
The behaviour of the title happens on the latest commit to master (3becf32), which corresponds to the version 1.2.0.
Here is a working example that can be used for a reproduction.
Starting julia with a single thread:
$ pwd
~/julia/ArgParse.jl
$ julia --project=. -t 1
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.10.2 (2024-03-01)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using ArgParse
julia> s = ArgParseSettings();
julia> add_arg_table!(s, ["--foo"], Dict(:arg_type=>Int64));
julia> ArgParse.parse_args(["--foo", "42"], s);
julia> fetch(Threads.@spawn ArgParse.parse_args(["--foo", "42"], s))
Dict{String, Any} with 1 entry:
"foo" => 42
Starting julia with two threads:
$ julia --project=. -t 2
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.10.2 (2024-03-01)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using ArgParse
julia> s = ArgParseSettings();
julia> add_arg_table!(s, ["--foo"], Dict(:arg_type=>Int64));
julia> ArgParse.parse_args(["--foo", "42"], s);
julia> fetch(Threads.@spawn ArgParse.parse_args(["--foo", "42"], s))
ERROR: TaskFailedException
Stacktrace:
[1] wait
@ ./task.jl:352 [inlined]
[2] fetch(t::Task)
@ Base ./task.jl:372
[3] top-level scope
@ threadingconstructs.jl:447
nested task error: ArgParseError("too many arguments")
Stacktrace:
[1] argparse_error(x::Any)
@ ArgParse ~/julia/ArgParse.jl/src/parsing.jl:9
[2] parse_arg!(state::ArgParse.ParserState, settings::ArgParseSettings)
@ ArgParse ~/julia/ArgParse.jl/src/parsing.jl:919
[3] parse_args_unhandled(args_list::Vector, settings::ArgParseSettings, truncated_shopts::Bool)
@ ArgParse ~/julia/ArgParse.jl/src/parsing.jl:633
[4] parse_args_unhandled(args_list::Vector, settings::ArgParseSettings)
@ ArgParse ~/julia/ArgParse.jl/src/parsing.jl:596
[5] parse_args(args_list::Vector, settings::ArgParseSettings; as_symbols::Bool)
@ ArgParse ~/julia/ArgParse.jl/src/parsing.jl:470
[6] parse_args(args_list::Vector, settings::ArgParseSettings)
@ ArgParse ~/julia/ArgParse.jl/src/parsing.jl:466
[7] (::var"#1#2")()
@ Main ./REPL[5]:1
The issue persists if instead of add_arg_table!
the macro @add_arg_table!
is used.
Metadata
Metadata
Assignees
Labels
No labels