What's Changed
- Fix the
msgpackandcbor2converters unstructuring naive datetimes as local time, which made the serialized value depend on the timezone of the machine doing the unstructuring; naive datetimes are now assumed to be UTC, matching what the structure hooks already read back. (#774 #775) - Fix
override(rename=...)targets containing a quote (or other characters not safe in a bare string literal) crashing code generation withSyntaxError; the rename key is now embedded withrepr. (#771) - Fix
Counterkeys not being unstructured with the key type's own hook; the single-type-arg branch passed the whole type-args tuple to the key hook lookup instead of the key type. (#768) - Fix
create_default_dis_func(akacreate_uniq_field_dis_func) failing to disambiguate valid unions depending on the order of the member classes; unique fields are now resolved iteratively to a fixpoint. (#230 #765) - Support more recursive types on 3.14+ with specialized factories for
annotationlib.ForwardRef. (#740 #741) Converternow uses specialized hook factories to generate hooks for tuples, increasing speed. (#737)- Fix an
AttributeErrorincattrsinternals that could be triggered by using theinclude_subclassesstrategy in astructure_hook_factory(#721, #722) - Fix TypedDict codegen when keys contain single quotes. (#769)
- Add
CattrsErrorexception type: all exceptions raised bycattrsinherit from this.
Literal and date-time validation raise this directly, instead ofException. (#728) - Fix the
detailed_validationparameter being passed under the wrong name innamedtuple_dict_structure_factory, causing it to be silently ignored. (#723) - cattrs is now autoformatted using Ruff. (#732)
- Support running the test suite without
cbor2installed. (#748) - The union passthrough strategy now supports PEP 695 type aliases as union members. (#753)
BaseConverter.register_structure_hook_factoryandBaseConverter.register_unstructure_hook_factorynow properly return the factory when used as decorators. (#724)- The
msgspecpreconf converter now properly handles recursive classes on Python 3.14+. (#757)
New Contributors
- @mm-andritz made their first contribution in #722
- @bysiber made their first contribution in #723
- @yzhkali made their first contribution in #753
- @maxtaran2010 made their first contribution in #766
- @vineethsaivs made their first contribution in #765
- @uttam12331 made their first contribution in #768
- @winklemad made their first contribution in #771
- @onk3sh made their first contribution in #775
Full Changelog: v26.1.0...v26.2.0