Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix wrong parameter name in namedtuple_dict_structure_factory#723

Open
bysiber wants to merge 2 commits intopython-attrs:main from
bysiber:fix/namedtuple-detailed-validation-param
Open

Fix wrong parameter name in namedtuple_dict_structure_factory #723
bysiber wants to merge 2 commits intopython-attrs:main from
bysiber:fix/namedtuple-detailed-validation-param

Conversation

@bysiber
Copy link

@bysiber bysiber commented Feb 20, 2026

namedtuple_dict_structure_factory passes _cattrs_use_detailed_validation to make_dict_structure_fn_from_attrs, but the expected parameter name is _cattrs_detailed_validation (without the use_ prefix).

Since make_dict_structure_fn_from_attrs accepts **kwargs for attribute overrides, the misnamed keyword is silently swallowed as if it were an attribute override key, and _cattrs_detailed_validation falls back to its default "from_converter".

This means the detailed_validation argument to namedtuple_dict_structure_factory has 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.

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.
Copy link
Member

Tinche commented Feb 20, 2026

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).

Copy link

codspeed-hq bot commented Feb 20, 2026
edited
Loading

Merging this PR will not alter performance

✅ 54 untouched benchmarks


Comparing bysiber:fix/namedtuple-detailed-validation-param (adaa399) with main (fd887b7)

Open in CodSpeed

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.
Copy link
Author

bysiber commented Feb 20, 2026

Added a regression test and a HISTORY.md entry in the latest push. The test creates a converter with detailed_validation=False but passes detailed_validation=True to the factory, verifying the parameter is actually forwarded correctly.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /