Fix wrong parameter name in namedtuple_dict_structure_factory#723
Merged
Tinche merged 3 commits intopython-attrs:mainfrom Mar 3, 2026
Merged
Conversation
Member
|
Ooph, you're right, that's embarrassing. Please add a unit test for this, and a changelog entry (you can use NEXT for the version). |
Contributor
Author
|
Added a regression test and a HISTORY.md entry in the latest push. The test creates a converter with |
The call to make_dict_structure_fn_from_attrs passes _cattrs_use_detailed_validation but the function expects _cattrs_detailed_validation. Because **kwargs catches the misnamed parameter as an attribute override, detailed_validation is silently ignored and always falls back to the converter default.
Add a test that verifies the detailed_validation parameter passed to namedtuple_dict_structure_factory is actually used and not silently ignored. Also add a HISTORY.md entry for the fix.
015863a to
5fd1c7f
Compare
Member
|
Thanks, I took the liberty of fixing the test and merging the changelog to nudge this along. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
namedtuple_dict_structure_factorypasses_cattrs_use_detailed_validationtomake_dict_structure_fn_from_attrs, but the expected parameter name is_cattrs_detailed_validation(without theuse_prefix).Since
make_dict_structure_fn_from_attrsaccepts**kwargsfor attribute overrides, the misnamed keyword is silently swallowed as if it were an attribute override key, and_cattrs_detailed_validationfalls back to its default"from_converter".This means the
detailed_validationargument tonamedtuple_dict_structure_factoryhas no effect — the converter's default is always used regardless of what's passed.The fix renames the keyword to match the actual parameter name.