← 输入框|bugs.python.org|刷新

➜

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.

classification
标题: Add `module`/`qualname` arguments to make_dataclass for picklability
类型: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7
process
状态: open Resolution:
Dependencies: 后续:
分配给: 抄送列表: cheryl.sabella, eric.smith, levkivskyi, remi.lapeyre
优先级: normal 关键字: patch, patch

Antony.Lee 于 2018-11-13 14:30 创建。最近一次由 admin 于 2022-04-11 14:59 修改。

Pull Requests
URL Status Linked Edit
PR 11371 open remi.lapeyre, 2018-12-30 20:06
PR 11371 open remi.lapeyre, 2018-12-30 20:06
Messages (3)
msg329847 - (view) Author: Antony Lee (Antony.Lee) * 日期: 2018-11-13 14:30
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 `module` and a `qualname` kwarg, similarly to the Enum functional form (https://docs.python.org/3/library/enum.html#functional-api).
msg332761 - (view) Author: Rémi Lapeyre (remi.lapeyre) * 日期: 2018-12-30 20:36
Hi @Anthony.Lee, the __module__ is wrong indeed. The new changeset in https://github.com/python/cpython/pull/11371 should implement what you need.

If you don't specify the new `module` and `qualname` parameters, make_dataclass() will try to determine the correct `module` so you should not need to change your code.
msg342283 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) 日期: 2019-05-13 03:47
@eric.smith   Can you take a look at this when you get a chance?  Thanks!
历史
日期 用户 动作 参数
2022-04-11 14:59:08admin修改github: 79413
2020-06-21 00:43:53remi.lapeyre修改versions: + Python 3.7, Python 3.8, Python 3.9
2020-06-21 00:43:19remi.lapeyre修改versions: + Python 3.10, - Python 3.8
2019-05-13 03:47:38cheryl.sabella修改keywords: patch, patch
抄送: + cheryl.sabella
消息: + msg342283

2019-04-11 13:03:31Antony.Lee修改抄送: - Antony.Lee
2019-04-11 12:46:46cheryl.sabella修改keywords: patch, patch
type: enhancement
versions: + Python 3.8, - Python 3.7
2018-12-30 20:36:24remi.lapeyre修改抄送: + remi.lapeyre
消息: + msg332761
2018-12-30 20:06:58remi.lapeyre修改keywords: + patch
stage: patch review
pull_requests: + pull_request10711
2018-12-30 20:06:51remi.lapeyre修改keywords: + patch
stage: (no value)
pull_requests: + pull_request10710
2018-11-16 21:38:56levkivskyi修改抄送: + levkivskyi
2018-11-13 18:35:28xtreak修改抄送: + eric.smith
2018-11-13 14:30:46Antony.Lee创建