def _unpack(space, format, buf): fmtiter = UnpackFormatIterator(space, buf) try: fmtiter.interpret(format) except StructOverflowError as e: raise OperationError(space.w_OverflowError, space.newtext(e.msg)) except StructError as e: raise OperationError(get_error(space), space.newtext(e.msg)) return space.newtuple(fmtiter.result_w[:])
def _unpack(space, format, buf): fmtiter = UnpackFormatIterator(space, buf) try: fmtiter.interpret(format) except StructOverflowError as e: raise OperationError(space.w_OverflowError, space.wrap(e.msg)) except StructError as e: raise OperationError(get_error(space), space.wrap(e.msg)) return space.newtuple(fmtiter.result_w[:])
def unpack(space, format, input): fmtiter = UnpackFormatIterator(space, input) try: fmtiter.interpret(format) except StructError, e: raise e.at_applevel(space)
def unpack(space, format, input): fmtiter = UnpackFormatIterator(space, input) try: fmtiter.interpret(format) except StructOverflowError, e: raise OperationError(space.w_OverflowError, space.wrap(e.msg))
def _unpack(space, format, buf): fmtiter = UnpackFormatIterator(space, buf) try: fmtiter.interpret(format) except StructOverflowError, e: raise OperationError(space.w_OverflowError, space.wrap(e.msg))
def value_from_bytes(self, space, s): from pypy.module.struct.formatiterator import UnpackFormatIterator buf = StringBuffer(s) fmtiter = UnpackFormatIterator(space, buf) fmtiter.interpret(self.getformat()) return fmtiter.result_w[0]