File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# History
22
3+ ## 23.2.3 (UNRELEASED)
4+
5+ - Fix a regression when unstructuring dictionary values typed as ` Any ` .
6+ ([ #453 ] ( https://github.com/python-attrs/cattrs/issues/453 ) [ #462 ] ( https://github.com/python-attrs/cattrs/pull/462 ) )
7+ - Generate unique files only in case of linecache enabled.
8+ ([ #445 ] ( https://github.com/python-attrs/cattrs/issues/445 ) [ #441 ] ( https://github.com/python-attrs/cattrs/pull/461 ) )
9+
310## 23.2.2 (2023-11-21)
411
512- Fix a regression when unstructuring ` Any | None ` .
6- ([ #453 ] ( https://github.com/python-attrs/cattrs/issues/453 ) )
7- - Generate unique files only in case of linecache enabled. ([ #445 ] ( https://github.com/python-attrs/cattrs/issues/445 ) [ #441 ] ( https://github.com/python-attrs/cattrs/pull/461 ) )
13+ ([ #453 ] ( https://github.com/python-attrs/cattrs/issues/453 ) [ #454 ] ( https://github.com/python-attrs/cattrs/pull/454 ) )
814
915## 23.2.1 (2023-11-18)
1016
Original file line number Diff line number Diff line change @@ -743,9 +743,11 @@ def make_mapping_unstructure_fn(
743743 if kh == identity :
744744 kh = None
745745
746- val_handler = converter ._unstructure_func .dispatch (val_arg )
747- if val_handler == identity :
748- val_handler = None
746+ if val_arg is not Any :
747+ # TODO: Remove this once we have more consistent Any handling in place.
748+ val_handler = converter ._unstructure_func .dispatch (val_arg )
749+ if val_handler == identity :
750+ val_handler = None
749751
750752 globs = {
751753 "__cattr_mapping_cl" : unstructure_to or cl ,
Original file line number Diff line number Diff line change 1+ """Tests for handling `typing.Any`."""
2+ from typing import Any , Dict
3+
4+ from attrs import define
5+
6+
7+ @define
8+ class A :
9+ pass
10+
11+
12+ def test_unstructuring_dict_of_any (converter ):
13+ """Dicts with Any values should use runtime dispatch for their values."""
14+ assert converter .unstructure ({"a" : A ()}, Dict [str , Any ]) == {"a" : {}}
You can’t perform that action at this time.
0 commit comments