Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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 copiedBasically applying the same fix for asdict from #32056 to astuple.
Your environment
- CPython versions tested on: 3.10.7
- Operating system and architecture: macOS, arm64
Linked PRs
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error