Skip to content

Commit aaeb2c4

Browse files
committed
arghparse: fix compatibility with Python 3.12.8
Closes: #103 Signed-off-by: Michał Górny <mgorny@gentoo.org>
1 parent 817418d commit aaeb2c4

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

NEWS.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Release Notes
33
=============
44

5+
snakeoil 0.10.10 (2024-12-04)
6+
----------------------------
7+
8+
- arghparse: fix compatibility with Python 3.12.8 (Michał Górny)
9+
510
snakeoil 0.10.9 (2024-10-02)
611
----------------------------
712

src/snakeoil/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"""
1212

1313
__title__ = "snakeoil"
14-
__version__ = "0.10.9"
14+
__version__ = "0.10.10"

src/snakeoil/cli/arghparse.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,15 @@ def parse_known_args(self, args, namespace):
12471247
namespace, args = functor(parser, namespace, args)
12481248

12491249
# parse the arguments and exit if there are any errors
1250-
namespace, args = self._parse_known_args(args, namespace)
1250+
# Python 3.12.8 introduced obligatory intermixed arg. The same
1251+
# commit adds _parse_known_args2 function, so use that to determine
1252+
# if we need to pass that.
1253+
if hasattr(self, "_parse_known_args2"):
1254+
namespace, args = self._parse_known_args(
1255+
args, namespace, intermixed=False
1256+
)
1257+
else:
1258+
namespace, args = self._parse_known_args(args, namespace)
12511259
if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):
12521260
args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))
12531261
delattr(namespace, _UNRECOGNIZED_ARGS_ATTR)

0 commit comments

Comments
 (0)