8000 gh-98169 dataclasses.astuple support DefaultDict by kwsp · Pull Request #98170 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-98169 dataclasses.astuple support DefaultDict #98170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed links to the bugs
  • Loading branch information
kwsp committed Oct 11, 2022
commit 8aa1b3dff4865535d9b4bbefe5a6f6c02425536a
2 changes: 0 additions & 2 deletions Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,6 @@ def _asdict_inner(obj, dict_factory):
if hasattr(type(obj), 'default_factory'):
# obj is a defaultdict, which has a different constructor from
# dict as it requires the default_factory as its first arg.
# https://bugs.python.org/issue35540
result = type(obj)(getattr(obj, 'default_factory'))
for k, v in obj.items():
result[_asdict_inner(k, dict_factory)] = _asdict_inner(v, dict_factory)
Expand Down Expand Up @@ -1389,7 +1388,6 @@ def _astuple_inner(obj, tuple_factory):
if hasattr(type(obj), 'default_factory'):
# obj is a defaultdict, which has a different constructor from
# dict as it requires the default_factory as its first arg.
# https://bugs.python.org/issue35540
result = type(obj)(getattr(obj, 'default_factory'))
for k, v in obj.items():
result[_astuple_inner(k, tuple_factory)] = _asdict_inner(v, tuple_factory)
Expand Down
0