lib.data: no loop required, we return or die.

This commit is contained in:
Charlotte 2023-07-02 15:23:17 +10:00 committed by Catherine
parent cdf8fcc32f
commit f4b013ac73

View file

@ -674,8 +674,7 @@ class View(ValueCastable):
value = self.__target[field.offset:field.offset + field.width]
# Field guarantees that the shape-castable object is well-formed, so there is no need
# to handle erroneous cases here.
while isinstance(shape, ShapeCastable):
if hasattr(shape, "__call__"):
if isinstance(shape, ShapeCastable):
value = shape(value)
if not isinstance(value, (Value, ValueCastable)):
raise TypeError("{!r}.__call__() must return a value or "