FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`match_args`, `slots` and possibly `kw_only` missing from `__dataclass_params__` · Issue #96142 · python/cpython · GitHub

Repository navigation

match_args, slots and possibly kw_only missing from __dataclass_params__ #96142

Closed

Description

Bug report

Dataclasses have an undocumented __dataclass_params__ class-attribute which appears to document the flags sent to the dataclass decorator:

cpython/Lib/dataclasses.py

Lines 903 to 904 in 6ec57e7

setattr(cls, _PARAMS, _DataclassParams(init, repr, eq, order,
unsafe_hash, frozen))

A few new flags have been added since the initial implementation of dataclasses. These don't seem to have been added to the __dataclass_params__ field. In the case of kw_only I think that makes sense - it's effectively controlled at a per-field level and the parameter to the dataclass decorator is just a convenience. However, the others seem like a genuine omission.

Your environment

I've just looked at the code for the current main branch.

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Aug 20, 2022
  2. added a commit that references this issue on Aug 29, 2022
  3. added a commit that references this issue on Oct 4, 2022
  4. ericvsmith commented on Oct 4, 2022

    Member

    Thanks, @sobolevn !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL