-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
arrayref out-of-range error upon first function parsing #1252
Comments
It will be helpful if re-throwing errors maintained the stack-trace. But until that can be achieved, it helps to do it manually by removing the high try/catch blocks and allowing the original error to propagate the line information: julia> parse_args(p, {"-h"}) On Sep 4, 2012, at 3:04 PM, Carlo Baldassi wrote:
|
Could this be a case of issue #922? I never believe the line numbers for arrayref errors; I just start commenting out blocks of code and see what changes the outcome (suboptimal, of course). |
Ah, I didn't think about removing the try/catch block, thanks Jameson. Tim, I don't think this is related to issue 922: what I did was in fact commenting out code and insert print statements, and as I wrote I identified 1) line 1083 as the one where the error is thrown (and which shows up in Jameson's trace) and 2) line 1356 as the one which causes the error. |
Sorry for the noise, carry on! |
Thanks @vtjnash. Bug in code that's not running => compiler bug :) |
*) renamed objects: +) ArgumentParser -> ArgParseSettings +) import_parser -> import_settings +) argparser_usage -> usage_string +) is_mandatory -> required (field option) *) changed parse_args signature *) removed ArgParserAction type & singletons, substituted with symbols (when creating arg fields, strings are also recognized) *) removed add_argument *) added alternative means to add arg fields: +) add_arg_table macro: allows a cleaner definition +) add_arg_table function: pass all fields in the same argument list +) add_arg_fields: use a closure to add arg fields [some of these may go away] *) fixed and improved argument parsing *) improved machinery to distinguish options from positional arguments +) also added an optional 'allow_ambiguous_options' setting (false by default) *) import_settings can import all settings, not just the arg fields *) ignore dest_name for positional arguments *) the exception handler is now part of the settings *) removed ugly workaround for bug #1252, now fixed
The version of argparse.jl in this branch displays a very weird bug: the mere existence of the function call on line 1356 (marked by an "XXX") produces the following behaviour:
The error is triggered when the function
_parse_short_opt
(which contains the line) is called (line 1083), but I verified that the function is never actually executed, and the offending line 1356 wouldn't be reached anyway (theif
clause chooses the other branch). It seems that the error occurs at parsing time. In fact, calling it twice produces the correct result the second time:Commenting the function call at line 1356 removes the error.
Also, the error happens only when trying to return more than one value.
The text was updated successfully, but these errors were encountered: