Skip to content

Commit

Permalink
fix: stop using _parse_known_args - use parse_known_args
Browse files Browse the repository at this point in the history
after 3.14 there is change of signature in the function and those patches
are even picked up into debian 3.12 version thus breaking the code here,
and in effect disabling load of commands from extensions.  For a more
general fix on not picking up during early parsing failure:
datalad#7679

and the underlying issue: datalad#7678
  • Loading branch information
yarikoptic committed Nov 14, 2024
1 parent e93bb04 commit ed5ac41
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions datalad/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ def setup_parser(
description=help_gist,
formatter_class=formatter_class,
add_help=False,
# TODO: when dropping support for Python 3.8: uncomment below
# and use parse_known_args instead of _parse_known_args:
# # set to False so parse_known_args does not add its error handling
# # Added while RFing from using _parse_known_args to parse_known_args.
# exit_on_error=False,
exit_on_error=False,
)

# common options
Expand Down Expand Up @@ -353,7 +349,7 @@ def single_subparser_possible(cmdlineargs, parser, completing):
# Before doing anything additional and possibly expensive see may be that
# we have got the command already
try:
parsed_args, unparsed_args = parser._parse_known_args(
parsed_args, unparsed_args = parser.parse_known_args(
cmdlineargs[1:], argparse.Namespace())
# before anything handle possible datalad --version
if not unparsed_args and getattr(parsed_args, 'version', None):
Expand Down

0 comments on commit ed5ac41

Please sign in to comment.