Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

dataclasses.astuple breaks onDefaultDict #98169

Closed
Labels
type-bugAn unexpected behavior, bug, or error
@kwsp

Description

@kwsp

Bug report

This is very similar to#79721

fromdataclassesimportdataclass,astuplefromtypingimportDefaultDict,Listfromcollectionsimportdefaultdict@dataclassclassC:mp:DefaultDict[str,List]dd=defaultdict(list)dd["x"].append(12)c=C(mp=dd)d=astuple(c)# throws "TypeError: first argument must be callable or None"assertd== ({"x": [12]},)assertd[0]isnotc.mp# make sure defaultdict is copied

Basically applying the same fix forasdict from#32056 toastuple.

Your environment

  • CPython versions tested on: 3.10.7
  • Operating system and architecture: macOS, arm64

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp