commit: 936902901eb8df408a2bc708b327cf7e1325da16 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> AuthorDate: Mon Apr 8 19:32:45 2024 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Mon Apr 8 19:32:45 2024 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=93690290
arghparse: fix handling with python 3.11.9 In commit [0], the private function changes the tuple size it returns. By using `*_` in the middle, we can support both extracted versions (3 and 4) of the function. This investigation was done by ajak, thank you. [0] https://github.com/python/cpython/commit/c02b7ae4dd367444aa6822d5fb73b61e8f5a4ff9 Resolves: https://github.com/pkgcore/pkgcheck/issues/676 Resolves: https://github.com/pkgcore/pkgdev/issues/184 Investigated-by: John Helmert III <ajak <AT> gentoo.org> Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/snakeoil/cli/arghparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snakeoil/cli/arghparse.py b/src/snakeoil/cli/arghparse.py index ab458c8f..80443b7a 100644 --- a/src/snakeoil/cli/arghparse.py +++ b/src/snakeoil/cli/arghparse.py @@ -774,7 +774,7 @@ class OptionalsParser(argparse.ArgumentParser): def consume_optional(start_index): # get the optional identified at this index option_tuple = option_string_indices[start_index] - action, option_string, explicit_arg = option_tuple + action, option_string, *_, explicit_arg = option_tuple # identify additional optionals in the same arg string # (e.g. -xyz is the same as -x -y -z if no args are required)
