def _string_to_w_long(space, w_longtype, w_source, string, base=10): try: bigint = rbigint.fromstr(string, base) except ParseStringError as e: from pypy.objspace.std.intobject import wrap_parsestringerror raise wrap_parsestringerror(space, e, w_source) return newbigint(space, w_longtype, bigint)
def save_field(self, field_builder): space = self.space field = field_builder.build() if self.numeric_field: from rpython.rlib.rstring import ParseStringError from rpython.rlib.rfloat import string_to_float self.numeric_field = False try: ff = string_to_float(field) except ParseStringError as e: from pypy.objspace.std.intobject import wrap_parsestringerror raise wrap_parsestringerror(space, e, space.wrap(field)) w_obj = space.wrap(ff) else: w_obj = space.wrap(field) self.fields_w.append(w_obj)
def _string_to_float(space, w_source, string): try: return rfloat.string_to_float(string) except ParseStringError as e: from pypy.objspace.std.intobject import wrap_parsestringerror raise wrap_parsestringerror(space, e, w_source)