Skip to content

Commit 3bb5d42

Browse files
committed
Ruggedize override so it would be safe on any version of Python and type checkers won't complain
1 parent 2587813 commit 3bb5d42

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd2/argparse_custom.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,11 @@ def _set_color(self, color: bool, **kwargs: Any) -> None:
10361036
This override is needed because Python 3.15 added a 'file' keyword argument
10371037
to _set_color() which some versions of RichHelpFormatter don't support.
10381038
"""
1039-
try:
1039+
# Argparse didn't add color support until 3.14
1040+
if sys.version_info < (3, 14):
1041+
return
1042+
1043+
try: # type: ignore[unreachable]
10401044
super()._set_color(color, **kwargs)
10411045
except TypeError:
10421046
# Fallback for older versions of RichHelpFormatter that don't support keyword arguments

0 commit comments

Comments
 (0)