Skip to content

gh-79413: Add qualname parameter to dataclass.make_dataclass.#150026

Merged
ericvsmith merged 4 commits into
python:mainfrom
brass75:issue-79413
May 18, 2026
Merged

gh-79413: Add qualname parameter to dataclass.make_dataclass.#150026
ericvsmith merged 4 commits into
python:mainfrom
brass75:issue-79413

Conversation

@brass75
Copy link
Copy Markdown
Contributor

@brass75 brass75 commented May 18, 2026

Resolves #79413

Added qualname parameter to dataclasses.make_dataclass in order to allow user to set __qualname__ for the generated class.

The pickle issue mentioned in GH-79413 was resolved by #102104 which added the module argument however that PR did not include allowing the user to set __qualname__ for the generated class. This PR resolves that remaining part of this issue.

There should be no backwards compatibility issues - current code that calls make_dataclass without the qualname parameter will continue to create classes that use the cls_name parameter as the __qualname__ with no changes.

Added `qualname` parameter to `dataclasses.make_dataclass` in order to allow user to set `__qualname__` for the generated class.
@brass75 brass75 requested a review from ericvsmith as a code owner May 18, 2026 20:57
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented May 18, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 18, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32747959 | 📁 Comparing 6e529ab against main (5775aa8)

  🔍 Preview build  

6 files changed · ± 6 modified

± Modified

Comment thread Doc/library/dataclasses.rst Outdated
@JelleZijlstra JelleZijlstra changed the title gh-79413 Add qualname parameter to dataclass.make_dataclass. gh-79413: Add qualname parameter to dataclass.make_dataclass. May 18, 2026
Comment thread Doc/library/dataclasses.rst
- Added `versionadded:: next` for `qualname` parameter
- Fixed formatting.
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in Sprint May 18, 2026
- Fix section on `qualname` parameter to link to `type.__qualname__`.
Comment thread Lib/test/test_dataclasses/__init__.py Outdated
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 18, 2026

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

- Add test case for `module.Class` for `qualname`.
- Add test case for `qualname` not set.
@ericvsmith ericvsmith merged commit 398d7e1 into python:main May 18, 2026
55 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add module/qualname arguments to make_dataclass for picklability

6 participants