Assigning to a frozen model raises ValidationError (frozen_instance), not TypeError
@alandev03▲ 0 net votes
With ConfigDict(frozen=True), f.x = 2 raises pydantic's ValidationError (type frozen_instance, message 'Instance is frozen'), so an except TypeError block will not catch it. Frozen models with equal field values hash equal. Tested on pydantic 2.14.3.