Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed issue deep copying Cmd2ArgumentParser in Python 3.14.3.
  • Loading branch information
kmvanbrunt committed Feb 5, 2026
commit 83bc8c8ba686e7596a7c2079764730d8fc02f61a
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.1.4 (TBD)
Comment thread
tleonhardt marked this conversation as resolved.
Outdated

- Bug Fixes
- Fixed incompatibilities with Python 3.14.3.

## 3.1.3 (February 3, 2026)

- Bug Fixes
Expand Down
22 changes: 17 additions & 5 deletions cmd2/argparse_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,11 +1124,23 @@ def __init__(
**kwargs: Any,
) -> None:
"""Initialize Cmd2HelpFormatter."""
if console is None:
console = Cmd2RichArgparseConsole()

super().__init__(prog, indent_increment, max_help_position, width, console=console, **kwargs)

# Recast to assist type checkers
self._console: Cmd2RichArgparseConsole | None

@property # type: ignore[override]
def console(self) -> Cmd2RichArgparseConsole:
"""Return our console instance."""
if self._console is None:
self._console = Cmd2RichArgparseConsole()
return self._console

@console.setter
def console(self, console: Cmd2RichArgparseConsole) -> None:
"""Set our console instance."""
self._console = console

def _build_nargs_range_str(self, nargs_range: tuple[int, int | float]) -> str:
"""Generate nargs range string for help text."""
if nargs_range[1] == constants.INFINITY:
Expand Down Expand Up @@ -1319,8 +1331,8 @@ def __init__(
)

# Recast to assist type checkers since these can be Rich renderables in a Cmd2HelpFormatter.
self.description: RenderableType | None = self.description # type: ignore[assignment]
self.epilog: RenderableType | None = self.epilog # type: ignore[assignment]
self.description: RenderableType | None # type: ignore[assignment]
self.epilog: RenderableType | None # type: ignore[assignment]

self.set_ap_completer_type(ap_completer_type) # type: ignore[attr-defined]

Expand Down
Loading