commit:     817418dd4036d504a2d27fa600426de0770c03a4
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  2 12:55:31 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Oct  2 12:55:31 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=817418dd

arghparse: fix compatibility with Python 3.12.7

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 NEWS.rst                      | 5 +++++
 src/snakeoil/__init__.py      | 2 +-
 src/snakeoil/cli/arghparse.py | 3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/NEWS.rst b/NEWS.rst
index ffa0fdf1..4a374360 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -2,6 +2,11 @@
 Release Notes
 =============
 
+snakeoil 0.10.9 (2024-10-02)
+----------------------------
+
+- arghparse: fix compatibility with Python 3.12.7 (Arthur Zamarin)
+
 snakeoil 0.10.8 (2024-04-08)
 ----------------------------
 

diff --git a/src/snakeoil/__init__.py b/src/snakeoil/__init__.py
index 895309fd..865dedf2 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.8"
+__version__ = "0.10.9"

diff --git a/src/snakeoil/cli/arghparse.py b/src/snakeoil/cli/arghparse.py
index 80443b7a..2897829f 100644
--- a/src/snakeoil/cli/arghparse.py
+++ b/src/snakeoil/cli/arghparse.py
@@ -739,6 +739,9 @@ class OptionalsParser(argparse.ArgumentParser):
                 if option_tuple is None:
                     pattern = "A"
                 else:
+                    if len(option_tuple) == 1:
+                        # 
https://github.com/python/cpython/commit/cbea45ad74779c0ffe760bab7f9d5ce149302495
+                        option_tuple = option_tuple[0]
                     option_string_indices[i] = option_tuple
                     pattern = "O"
                 arg_string_pattern_parts.append(pattern)

Reply via email to