aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-12-04 14:13:33 +0100
committerMichał Górny <mgorny@gentoo.org>2024-12-04 14:18:14 +0100
commitaaeb2c42797a2599541b4188e4d2d5a744de134b (patch)
treeabba3a18681975970b5d52cf3f3342e7c7997c36 /src/snakeoil
parentarghparse: fix compatibility with Python 3.12.7 (diff)
downloadsnakeoil-master.tar.gz
snakeoil-master.tar.bz2
snakeoil-master.zip
arghparse: fix compatibility with Python 3.12.8HEADv0.10.10master
Closes: https://github.com/pkgcore/snakeoil/issues/103 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'src/snakeoil')
-rw-r--r--src/snakeoil/__init__.py2
-rw-r--r--src/snakeoil/cli/arghparse.py10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/snakeoil/__init__.py b/src/snakeoil/__init__.py
index 865dedf2..5d709e4c 100644
--- a/src/snakeoil/__init__.py
+++ b/src/snakeoil/__init__.py
@@ -11,4 +11,4 @@ This library is a bit of a grabbag of the following:
"""
__title__ = "snakeoil"
-__version__ = "0.10.9"
+__version__ = "0.10.10"
diff --git a/src/snakeoil/cli/arghparse.py b/src/snakeoil/cli/arghparse.py
index 2897829f..4938b181 100644
--- a/src/snakeoil/cli/arghparse.py
+++ b/src/snakeoil/cli/arghparse.py
@@ -1247,7 +1247,15 @@ class ArgumentParser(OptionalsParser, CsvActionsParser):
namespace, args = functor(parser, namespace, args)
# parse the arguments and exit if there are any errors
- namespace, args = self._parse_known_args(args, namespace)
+ # Python 3.12.8 introduced obligatory intermixed arg. The same
+ # commit adds _parse_known_args2 function, so use that to determine
+ # if we need to pass that.
+ if hasattr(self, "_parse_known_args2"):
+ namespace, args = self._parse_known_args(
+ args, namespace, intermixed=False
+ )
+ else:
+ namespace, args = self._parse_known_args(args, namespace)
if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):
args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))
delattr(namespace, _UNRECOGNIZED_ARGS_ATTR)