Skip to content

Commit

Permalink
arghparse: fix compatibility with Python 3.12.8
Browse files Browse the repository at this point in the history
Closes: #103
Signed-off-by: Michał Górny <mgorny@gentoo.org>
  • Loading branch information
mgorny committed Dec 4, 2024
1 parent 817418d commit 7777e5f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
----------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/snakeoil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"""

__title__ = "snakeoil"
__version__ = "0.10.9"
__version__ = "0.10.10"
9 changes: 8 additions & 1 deletion src/snakeoil/cli/arghparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,14 @@ def parse_known_args(self, args, namespace):
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)
Expand Down

0 comments on commit 7777e5f

Please sign in to comment.