Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dataclasses: it should be an error to specify KW_ONLY twice #88181

Closed
ericvsmith opened this issue May 3, 2021 · 2 comments
Closed

dataclasses: it should be an error to specify KW_ONLY twice #88181

ericvsmith opened this issue May 3, 2021 · 2 comments
Assignees
Labels
3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ericvsmith
Copy link
Member

BPO 44015
Nosy @ericvsmith
PRs
  • bpo-44015: dataclasses should allow KW_ONLY to be specified only once per class #25841
  • 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:

    assignee = 'https://github.com/ericvsmith'
    closed_at = <Date 2021-05-03.07:26:01.594>
    created_at = <Date 2021-05-03.06:09:50.431>
    labels = ['type-bug', 'library', '3.10']
    title = 'dataclasses: it should be an error to specify KW_ONLY twice'
    updated_at = <Date 2021-05-03.07:26:01.594>
    user = 'https://github.com/ericvsmith'

    bugs.python.org fields:

    activity = <Date 2021-05-03.07:26:01.594>
    actor = 'eric.smith'
    assignee = 'eric.smith'
    closed = True
    closed_date = <Date 2021-05-03.07:26:01.594>
    closer = 'eric.smith'
    components = ['Library (Lib)']
    creation = <Date 2021-05-03.06:09:50.431>
    creator = 'eric.smith'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44015
    keywords = ['patch']
    message_count = 2.0
    messages = ['392768', '392772']
    nosy_count = 1.0
    nosy_names = ['eric.smith']
    pr_nums = ['25841']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44015'
    versions = ['Python 3.10']

    @ericvsmith
    Copy link
    Member Author

    Specifying KW_ONLY twice should raise an exception, but does not:

    >>> @dataclasses.dataclass
    ... class foo:
    ...   _: dataclasses.KW_ONLY
    ...   x: dataclasses.KW_ONLY
    ...

    @ericvsmith ericvsmith added the 3.10 only security fixes label May 3, 2021
    @ericvsmith ericvsmith self-assigned this May 3, 2021
    @ericvsmith ericvsmith added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error 3.10 only security fixes labels May 3, 2021
    @ericvsmith ericvsmith self-assigned this May 3, 2021
    @ericvsmith ericvsmith added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 3, 2021
    @ericvsmith
    Copy link
    Member Author

    New changeset 99ad742 by Eric V. Smith in branch 'master':
    bpo-44015: dataclasses should allow KW_ONLY to be specified only once per class (GH-25841)
    99ad742

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant