diff --git a/colcon_core/command.py b/colcon_core/command.py index fd159be1..228d3b36 100644 --- a/colcon_core/command.py +++ b/colcon_core/command.py @@ -226,7 +226,15 @@ class CustomArgumentParser(argparse.ArgumentParser): def _parse_optional(self, arg_string): result = super()._parse_optional(arg_string) - if result == (None, arg_string, None): + # Up until https://github.com/python/cpython/pull/114180 , + # _parse_optional() returned a 3-tuple when it couldn't classify + # the option. As of that PR (which is in Python 3.13, and + # backported to Python 3.12), it returns a 4-tuple. Check for + # either here. + if result in ( + (None, arg_string, None), + (None, arg_string, None, None), + ): # in the case there the arg is classified as an unknown 'O' # override that and classify it as an 'A' return None diff --git a/test/spell_check.words b/test/spell_check.words index 96051a0f..83548464 100644 --- a/test/spell_check.words +++ b/test/spell_check.words @@ -3,6 +3,7 @@ apache argparse asyncio autouse +backported basepath bazqux blocklist @@ -17,6 +18,7 @@ configparser contextlib coroutine coroutines +cpython datetime debian debinfo