Skip to content

dataclasses.asdict() mishandles dataclass instance attributes that are instances of subclassed typing.NamedTuple #78544

Description

@alexdelorenzo
BPO 34363
Nosy @rhettinger, @ericvsmith, @NeilGirdhar, @ilevkivskyi, @alexdelorenzo
PRs
  • bpo-34363: Handle namedtuples fields correctly in asdict() and astuple(). #8728
  • bpo-34363: dataclasses.asdict() and .astuple() now handle fields which are namedtuples. #9151
  • [3.7] bpo-34363: dataclasses.asdict() and .astuple() now handle fields which are namedtuples. (GH-9151) #9304
  • 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 2018-09-14.18:08:11.258>
    created_at = <Date 2018-08-08.19:41:25.876>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = 'dataclasses.asdict() mishandles dataclass instance attributes that are instances of subclassed typing.NamedTuple'
    updated_at = <Date 2018-09-16.16:27:38.430>
    user = 'https://github.com/alexdelorenzo'

    bugs.python.org fields:

    activity = <Date 2018-09-16.16:27:38.430>
    actor = 'levkivskyi'
    assignee = 'eric.smith'
    closed = True
    closed_date = <Date 2018-09-14.18:08:11.258>
    closer = 'eric.smith'
    components = ['Library (Lib)']
    creation = <Date 2018-08-08.19:41:25.876>
    creator = 'alexdelorenzo'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34363
    keywords = ['patch']
    message_count = 18.0
    messages = ['323298', '323300', '323305', '323312', '323320', '323352', '323353', '323364', '323377', '323380', '323383', '323384', '323391', '324971', '325046', '325353', '325372', '325494']
    nosy_count = 5.0
    nosy_names = ['rhettinger', 'eric.smith', 'NeilGirdhar', 'levkivskyi', 'alexdelorenzo']
    pr_nums = ['8728', '9151', '9304']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34363'
    versions = ['Python 3.7', 'Python 3.8']

    Metadata

    Metadata

    Assignees

    Labels

    3.7 (EOL)end of life3.8 (EOL)end of lifestdlibStandard 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