Allow int for max_warnings in TOML - #14954
Conversation
The max_warnings option was registered without a type (defaulting to 'string'), so integer values in native TOML config raised a TypeError. It is now registered with type=int | str, accepting both int and string values in TOML while keeping the string form working for backward compatibility. An explicit integer 0 is distinguished from the unset default. Co-authored-by: Cursor Grok 4.6 <cursoragent@cursor.com>
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Looks reasonable thank you.
| result.assert_outcomes(passed=1, warnings=1) | ||
| assert result.ret == ExitCode.OK | ||
|
|
||
| @pytest.mark.filterwarnings("default::UserWarning") |
There was a problem hiding this comment.
We don't need those automated tests, the int | str mechanism is already tested elsewhere.
Co-authored-by: CenFangyu <Dmao233@users.noreply.github.com>
Co-authored-by: CenFangyu <164994318+Dmao233@users.noreply.github.com>
|
Thanks. I tested the current head,
I have three questions:
|
Co-authored-by: CenFangyu <Dmao233@users.noreply.github.com>
|
Addressed in f4d3a6c.
|
|
Thanks. I reran This resolves the discrepancies identified in the comparison above. |
Closes #14953
max_warningswas registered without a type, so native TOML integers (max_warnings = 0) were rejected even though the docs show an unquoted int.Register it as
int | strthe same way astruncation_limit_*._get_max_warnings()treatsNoneas unset so an explicit0is not the empty default.Checklist
closes #14953in the PR description and the commit.changelog/14953.bugfix.rst.AUTHORSin alphabetical order.Co-authored-bytrailer.