GitHub PR #29867 changed dataclasses’ check for mutable field default hard-coded list
/set
/dict
to anything with __hash__ = None
. This allowed non-mutable subclasses of these built-ins, but disallows any custom types that didn’t set __hash__
.
This is easy to support[1], but I didn’t know it was a problem until after I tested my library with Python 3.11 (at which point the docs said how to fix). I propose to bring more attention to this change by including it in the what’s new page. Right now, it’s buried in the change log.
-
for my pseudo-immutable object with
__slots__ = ()
, definedef __hash__(slf): return 42
↩︎