Skip to content

Apply attrs' converter to default before omit_if_default check#696

Merged
Tinche merged 5 commits intopython-attrs:mainfrom
antony-frolov:main
Nov 30, 2025
Merged

Apply attrs' converter to default before omit_if_default check#696
Tinche merged 5 commits intopython-attrs:mainfrom
antony-frolov:main

Conversation

@antony-frolov
Copy link
Contributor

No description provided.

@antony-frolov
Copy link
Contributor Author

Hi @Tinche! I've added a test to fix coverage, but don't really know what are the next steps to get this merged, can I get a review from you?

@Tinche
Copy link
Member

Tinche commented Nov 9, 2025

Yep, I've been busy but this is on my mind to review soon!

@Tinche Tinche self-requested a review November 11, 2025 22:15
Copy link
Member

@Tinche Tinche left a comment

Choose a reason for hiding this comment

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

Also, we need some docs: please add a versionchanged line to the function docstring (you can use NEXT as the version), and a changelog entry.

Copy link
Member

@Tinche Tinche left a comment

Choose a reason for hiding this comment

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

Left a comment, but LGTM. I'll be back in a few days to take a closer look.

@Tinche
Copy link
Member

Tinche commented Nov 30, 2025

Great job, thanks!

@Tinche Tinche merged commit 39a4d6e into python-attrs:main Nov 30, 2025
12 checks passed
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Feb 22, 2026
## 26.1.0 (2026-02-18)

- Add the {mod}`tomllib <cattrs.preconf.tomllib>` preconf converter.
  See [here](https://catt.rs/en/latest/preconf.html#tomllib) for details.
  ([#716](python-attrs/cattrs#716))
- Customizing un/structuring of _attrs_ classes, dataclasses, TypedDicts and dict NamedTuples is now possible by using `Annotated[T, override()]` on fields.
  See [here](https://catt.rs/en/stable/customizing.html#using-typing-annotated-t-override) for more details.
  ([#717](python-attrs/cattrs#717))
- Fix structuring of nested generic classes with stringified annotations.
  ([#688](python-attrs/cattrs#688))
- Python 3.9 is no longer supported, as it is end-of-life. Use previous versions on this Python version.
  ([#698](python-attrs/cattrs#698))
- Apply the attrs converter to the default value before checking if it is equal to the attribute's value, when `omit_if_default` is true and an attrs converter is specified.
  ([#696](python-attrs/cattrs#696))
- Use the optional `_value_` type hint to structure and unstructure enums if present.
  ([#699](python-attrs/cattrs#699))
- Aliases (when in use) now properly generate rename metadata in generated hooks.
  ([#706](python-attrs/cattrs#706) [#710](python-attrs/cattrs#710))
- _cattrs_ now tracks performance using [codspeed](https://codspeed.io/python-attrs/cattrs).
  ([#703](python-attrs/cattrs#703))
- The {mod}`tomlkit <cattrs.preconf.tomlkit>` preconf converter now properly handles native `date` objects when structuring.
  ([#707](python-attrs/cattrs#707) [#708](python-attrs/cattrs#708))
- The {mod}`tomlkit <cattrs.preconf.tomlkit>` preconf converter now passes date objects directly to _tomlkit_ for unstructuring.
  ([#707](python-attrs/cattrs#707) [#708](python-attrs/cattrs#708))
- Enum handling has been optimized by switching to hook factories, improving performance especially for plain enums.
  ([#705](python-attrs/cattrs#705))
- Fix {func}`cattrs.strategies.include_subclasses` when used with {func}`cattrs.strategies.configure_tagged_union` and classes using diamond inheritance.
  ([#685](python-attrs/cattrs#685) [#713](python-attrs/cattrs#713))
- Fix {func}`cattrs.strategies.configure_tagged_union` when used with recursive type aliases.
  ([#678](python-attrs/cattrs#678) [#714](python-attrs/cattrs#714))
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.

2 participants