From ed5ac415f81e4120d2cb3d1ce5182b5287f150da Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 14 Nov 2024 14:33:22 -0500 Subject: [PATCH] fix: stop using _parse_known_args - use parse_known_args 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: https://github.com/datalad/datalad/pull/7679 and the underlying issue: https://github.com/datalad/datalad/issues/7678 --- datalad/cli/parser.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/datalad/cli/parser.py b/datalad/cli/parser.py index b3c44026ca..463d4714c9 100644 --- a/datalad/cli/parser.py +++ b/datalad/cli/parser.py @@ -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 @@ -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):