public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pkgcore/snakeoil:master commit in: /, src/snakeoil/cli/, src/snakeoil/
@ 2024-12-04 14:21 Michał Górny
  0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2024-12-04 14:21 UTC (permalink / raw
  To: gentoo-commits

commit:     aaeb2c42797a2599541b4188e4d2d5a744de134b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  4 13:13:33 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Dec  4 13:18:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=aaeb2c42

arghparse: fix compatibility with Python 3.12.8

Closes: https://github.com/pkgcore/snakeoil/issues/103
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 NEWS.rst                      |  5 +++++
 src/snakeoil/__init__.py      |  2 +-
 src/snakeoil/cli/arghparse.py | 10 +++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/NEWS.rst b/NEWS.rst
index 4a37436..38fe557 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -2,6 +2,11 @@
 Release Notes
 =============
 
+snakeoil 0.10.10 (2024-12-04)
+----------------------------
+
+- arghparse: fix compatibility with Python 3.12.8 (Michał Górny)
+
 snakeoil 0.10.9 (2024-10-02)
 ----------------------------
 

diff --git a/src/snakeoil/__init__.py b/src/snakeoil/__init__.py
index 865dedf..5d709e4 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 2897829..4938b18 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)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-04 14:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-04 14:21 [gentoo-commits] proj/pkgcore/snakeoil:master commit in: /, src/snakeoil/cli/, src/snakeoil/ Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox