def unpack(self, buffer):
fields = self._all_fields()<EOL>ctx = UnpackContext(self, fields, buffer)<EOL>for field in fields:<EOL><INDENT>try:<EOL><INDENT>if field.unpack_if.deref(ctx):<EOL><INDENT>for prev_field in field.unpack_after:<EOL><INDENT>prev_field.unpack_value_ref.deref(ctx)<EOL><DEDENT>field.unpack_value_ref.deref(ctx)<EOL><DEDENT>else:<EOL><INDENT>setattr(self, field.attr_name(), None)<EOL><DEDENT><DEDENT>except:<EOL><INDENT>raise chain_exceptions(InstructBufferError("<STR_LIT>", ctx, type(self), field.attr_name()))<EOL><DEDENT><DEDENT>return self.calc_byte_size(ctx)<EOL>
Unpacks the object's fields from buffer.