Skip to content

馃悰 Ensure that the default of a list argument is used correctly - #1821

Merged
tiangolo merged 4 commits into
fastapi:masterfrom
svlandeg:fix/default
Jun 2, 2026
Merged

馃悰 Ensure that the default of a list argument is used correctly#1821
tiangolo merged 4 commits into
fastapi:masterfrom
svlandeg:fix/default

Conversation

@svlandeg

@svlandeg svlandeg commented Jun 2, 2026

Copy link
Copy Markdown
Member

Pull Request

Discussion: #1811, reported by @tchervychek 馃檹

Description

Typer 0.26.0 introduced a regression with respect to using the default of a List argument. The only test we had related to this had an envvar setting, obscuring the bug.

Commit that caused this issue was attempting to fix things after cleaning up UNSET: svlandeg@cc485f6 馃槥

For good measure, I also added a test for the default of a list option, though this was working fine on master. Still, can't hurt to extend the test suite a little.

AI Disclaimer

Used Cursor for quick diagnostic, but reviewed and written everything myself.

Checklist

  • I added tests for the change.
  • The new or updated tests fail on the main branch and pass on this PR.
  • Coverage stays at 100%.

@svlandeg svlandeg added the bug Something isn't working label Jun 2, 2026
Comment thread tests/test_types.py
def test_list_empty() -> None:
result = runner.invoke(app, ["hello-all-args"])
assert result.exit_code == 0
assert "Hello World!" in result.output

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that it's this particular test that's failing on master, i.e. what this bug fix PR addresses.

@svlandeg
svlandeg marked this pull request as ready for review June 2, 2026 13:13

@tiangolo tiangolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you! This will be available in Typer 0.26.6 in a the next few hours. 馃殌

@tiangolo
tiangolo merged commit 06fce7d into fastapi:master Jun 2, 2026
22 checks passed
@svlandeg
svlandeg deleted the fix/default branch June 2, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants