Avatar for the python-attrs user
python-attrs
attrs
BlogDocsChangelog

Performance History

Latest Results

fix: recurse into collections nested inside collections in astuple() `attrs.astuple()` and `attr.astuple()` only converted *attrs* instances that were nested at most one collection deep: an instance inside a list inside a list, inside a tuple inside a list, or inside a list used as a mapping value was returned as-is. `attrs.asdict()` converts all of them. `astuple()` looked at the elements of a collection but never recursed into nested collections themselves, while `asdict()` routes every value through `_asdict_anything()`. Add `_astuple_anything()` -- mirroring `_asdict_anything()` -- and use it for collection items and mapping keys and values, so that nested collections are rebuilt according to *retain_collection_types*, *tuple_factory* is applied to instances found at any depth and *filter* is honored everywhere. Nested mappings are rebuilt from an intermediate dict, so subclasses like `OrderedDict` and `Counter` are reconstructed correctly; mappings whose constructor can't take a mapping object -- for example `defaultdict` -- fall back to a plain dict, just like `asdict()` does. Since mapping keys and values are now converted with the recursive helper, *filter* is also applied to *attrs* instances used as dictionary keys and values, consistently with sequences. Tests: `tests/test_funcs.py::TestAsTuple::test_nested_*` cover nested lists, tuples, mappings, namedtuples, mappings that can't be rebuilt, container keys and non-atomic values. They fail on the unfixed source. Signed-off-by: simpleqt <2015900818@qq.com>
simpleqt:fix-astuple-nested-collections
2 hours ago
perf: skip redundant atomic dict attrs detection in astuple
Johnny-Kao:perf/astuple-dict-atomic
10 hours ago
fix: simplify user-defined slot cleanup
emadleo13:fix-1637-user-defined-slots
2 days ago
test: expand coverage for user-defined slots
emadleo13:fix-1637-user-defined-slots
3 days ago
Preserve user-defined slots on attrs classes
emadleo13:fix-1637-user-defined-slots
3 days ago
Preserve user-defined slots on attrs classes
emadleo13:fix-1637-user-defined-slots
3 days ago

Latest Branches

CodSpeed Performance Gauge
-68%
fix: astuple() doesn't recurse into collections nested inside collections#1647
2 hours ago
9961295
simpleqt:fix-astuple-nested-collections
CodSpeed Performance Gauge
0%
11 hours ago
4e1f8f3
Johnny-Kao:perf/astuple-dict-atomic
CodSpeed Performance Gauge
0%
2 days ago
2f30632
emadleo13:fix-1637-user-defined-slots
© 2026 CodSpeed Technology
Home Terms Privacy Docs