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
Title: Remove namespace copy from dataclasses.make_dataclass()
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.smith Nosy List: eric.smith
Priority: normal Keywords: patch

Created on 2021-04-12 21:12 by eric.smith, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25372 merged eric.smith, 2021-04-12 22:08
Messages (1)
msg390907 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-04-12 21:12
In make_dataclasses(), the "namespace" argument is copied because it is mutated. This isn't really necessary: the callback passed to types.new_class() could just update its "ns" parameter with "namespace" and with the new attributes (__anotations__ and default field values).

This would eliminate the need to copy "namespace".
History
Date User Action Args
2022-04-11 14:59:44adminsetgithub: 87986
2021-04-14 23:31:18eric.smithsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-04-12 22:08:29eric.smithsetkeywords: + patch
stage: patch review
pull_requests: + pull_request24105
2021-04-12 21:12:10eric.smithcreate