Skip to content

Avoid eager LazyChoices loading during default validation#1709

Open
ReinerBRO wants to merge 1 commit intohttpie:masterfrom
ReinerBRO:fix-1640-json-content-type
Open

Avoid eager LazyChoices loading during default validation#1709
ReinerBRO wants to merge 1 commit intohttpie:masterfrom
ReinerBRO:fix-1640-json-content-type

Conversation

@ReinerBRO
Copy link

Summary

  • avoid eager LazyChoices loading when validating the action's own default
  • this prevents Python 3.14 default-validation paths from calling getter() during parser setup
  • add a regression test covering default-value validation behavior

Motivation

Fixes #1641.

Testing

  • python -m pytest tests/test_cli_utils.py -q

@ReinerBRO
Copy link
Author

I dug into the failing CI, and these failures do not appear to be introduced by this PR.

I reproduced the same three failures locally on both:

  • this PR branch (3607d94)
  • the base commit from master (5b604c3)

The failures are:

  • tests/test_cli_ui.py::test_naked_invocation[...] because the argparse invalid-choice wording is currently emitted without quotes around choices
  • tests/test_encoding.py::test_terminal_output_response_charset_detection[...]
  • tests/test_encoding.py::test_terminal_output_request_charset_detection[...]

For the encoding failures, the current environment resolves the Big5 sample via charset_normalizer as johab, which produces the same mojibake on both commits. So at least from local reproduction, the PR-specific LazyChoices change is not the cause of the red CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_lazy_choices_help fails on Python 3.14

1 participant