New submission from Gianni Mariani <gia...@mariani.ws>:

Using a frozendict as a default value should not cause an error in dataclasses. 
The check for mutability is:

   isinstance(f.default, (list, dict, set))

It appears frozendict has been changed to have a dict base class and it now 
raises an exception.

There should be a way to indicate object mutability as the purpose of the 
isinstance(f.default, (list, dict, set)) check is for mutable default values.

Using default_factory to work around this issue is cumbersome.

----------
components: Library (Lib)
messages: 397799
nosy: gianni
priority: normal
severity: normal
status: open
title: dataclasses should allow frozendict default value
type: compile error
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44674>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to