[issue35540] dataclasses.asdict breaks with defaultdict fields

2022-03-22 Thread Tiger
Change by Tiger : -- nosy: +kwsp nosy_count: 7.0 -> 8.0 pull_requests: +30148 pull_request: https://github.com/python/cpython/pull/32056 ___ Python tracker ___

[issue35540] dataclasses.asdict breaks with defaultdict fields

2021-10-28 Thread Raymond Xu
Raymond Xu added the comment: I am seeing this bug with 3.9.7 -- nosy: +greenfish6 ___ Python tracker ___ ___ Python-bugs-list

[issue35540] dataclasses.asdict breaks with defaultdict fields

2021-04-12 Thread Alexandru Coca
Alexandru Coca added the comment: I was wondering if this issue is still being tracked for resolution? I found the same bug in Python 3.8. -- nosy: +alexcoca ___ Python tracker

[issue35540] dataclasses.asdict breaks with defaultdict fields

2019-09-24 Thread Paul Ganssle
Paul Ganssle added the comment: I checked and it appears that `attrs` handles this by creating *all* dicts using the default dict_factory (similar to my original suggestion of just using `dict` instead of the specific type), if I'm reading this right:

[issue35540] dataclasses.asdict breaks with defaultdict fields

2019-09-24 Thread Paul Ganssle
Paul Ganssle added the comment: Considering that `namedtuple` is special-cased, I think it's reasonable to special-case `defaultdict` as well, though it may be worth considering more general solutions that will also work for things other than the standard library. One would be to solve this

[issue35540] dataclasses.asdict breaks with defaultdict fields

2019-09-24 Thread Paul Ganssle
Change by Paul Ganssle : -- pull_requests: +15935 pull_request: https://github.com/python/cpython/pull/16356 ___ Python tracker ___

[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-29 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi @wrmsr, this happens because the constructor for `collections.defaultdict` differs from the one of `dict`. I think the argument that collections.defaultdict is in the stdlib and should be supported is right, the changes in PR #11361 should do what you want.

[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-29 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- keywords: +patch, patch pull_requests: +10682, 10683 stage: -> patch review ___ Python tracker ___ ___

[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-29 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +10682 stage: -> patch review ___ Python tracker ___ ___

[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-29 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- keywords: +patch, patch, patch pull_requests: +10682, 10683, 10684 stage: -> patch review ___ Python tracker ___

[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-22 Thread Ivan Levkivskyi
Change by Ivan Levkivskyi : -- nosy: +levkivskyi __ Python tracker __ ___ Python-bugs-list mailing list

[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-19 Thread Eric V. Smith
Change by Eric V. Smith : -- assignee: -> eric.smith nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-19 Thread Will T
New submission from Will T : _asdict_inner attempts to manually recursively deepcopy dicts by calling type(obj) with a generator of transformed keyvalue tuples @ https://github.com/python/cpython/blob/b2f642ccd2f65d2f3bf77bbaa103dd2bc2733734/Lib/dataclasses.py#L1080 . defaultdicts are dicts