Skip to content

Commit

Permalink
Fix issue #590: Behavior change in argparse._parse_optional breaks …
Browse files Browse the repository at this point in the history
…the parse of optional arguments (#591)
  • Loading branch information
eggry authored Oct 7, 2024
1 parent a8b8b15 commit a209e1e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ The semantic versioning only considers the public API as described in
paths are considered internals and can change in minor and patch releases.


v4.33.2 (2024-10-??)
--------------------

Fixed
^^^^^
- Fix `parse_argv_item` to address the behavior change in `argparse` since Python 3.12.7 (`#591 <https://github.com/omni-us/jsonargparse/pull/591>`__).


v4.33.1 (2024-09-26)
--------------------

Expand Down
2 changes: 2 additions & 0 deletions jsonargparse/_typehints.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ def parse_argv_item(arg_string):
if typehint:
if parse_optional_num_return == 4:
return action, arg_base, sep, explicit_arg
elif parse_optional_num_return == 1:
return [(action, arg_base, sep, explicit_arg)]
return action, arg_base, explicit_arg
return None

Expand Down
6 changes: 6 additions & 0 deletions jsonargparse_tests/test_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def skip_if_argcomplete_unavailable():
pytest.skip("argcomplete package is required")


@pytest.fixture(autouse=True)
def temporal_skip_if_ge_py3127():
if sys.version_info[:3] >= (3, 12, 7):
pytest.skip("currently failing on python>=3.12.7 due to argparse breaking change")


@contextmanager
def mock_fdopen():
err = StringIO()
Expand Down

0 comments on commit a209e1e

Please sign in to comment.