Repository navigation
Add module/qualname arguments to make_dataclass for picklability #79413
Description
Activity
Currently, dataclasses created by make_dataclass are not picklable, because their module is set to "types". It seems that this would be easily fixed by letting make_dataclass gain a
moduleand aqualnamekwarg, similarly to the Enum functional form (https://docs.python.org/3/library/enum.html#functional-api).- added3.7 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Nov 13, 2018 Hi @Anthony.Lee, the __module__ is wrong indeed. The new changeset in #11371 should implement what you need.
If you don't specify the new
moduleandqualnameparameters, make_dataclass() will try to determine the correctmoduleso you should not need to change your code.- added3.8 (EOL)end of lifeend of lifetype-featureA feature request or enhancementA feature request or enhancementand removed3.7 (EOL)end of lifeend of life
on Apr 11, 2019 @eric.smith Can you take a look at this when you get a chance? Thanks!
- added3.10 (EOL)end of lifeend of life3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifeand removed3.8 (EOL)end of lifeend of life
on Jun 21, 2020 - added and removed3.10 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.7 (EOL)end of lifeend of life
on Aug 16, 2024 Adding
qualnamewould make sense to me, if you're still up to it.Agreed. @remilapeyre: Could you take a look at adding
qualname? And would this not also apply tonamedtuple?- added a commit that references this issue
on May 18, 2026
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
qualnameparameter todataclass.make_dataclass. #150026