This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author p-ganssle
Recipients eric.smith, levkivskyi, p-ganssle, remi.lapeyre, wrmsr
Date 2019-09-24.19:48:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569354507.89.0.562930811554.issue35540@roundup.psfhosted.org>
In-reply-to
Content
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: https://github.com/python-attrs/attrs/blob/master/src/attr/_funcs.py#L102

Using `attr.asdict` seems to bear this out, as `defaultdict` attributes are converted to `dict` when the dict factory is not specified.

I think changing the default behavior like that would be a backwards-incompatible change at this point (and one that it's really hard to warn about, unfortunately), but we could still use the "fall back to dict_factory" behavior by trying to construct a `type(obj)(...)` and in the case of an exception return `dict_factory(...)`.
History
Date User Action Args
2019-09-24 19:48:27p-gansslesetrecipients: + p-ganssle, eric.smith, levkivskyi, wrmsr, remi.lapeyre
2019-09-24 19:48:27p-gansslesetmessageid: <1569354507.89.0.562930811554.issue35540@roundup.psfhosted.org>
2019-09-24 19:48:27p-gansslelinkissue35540 messages
2019-09-24 19:48:27p-gansslecreate