Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r77889:7c18d4c2934f Date: 2015-06-05 09:49 +0100 http://bitbucket.org/pypy/pypy/changeset/7c18d4c2934f/
Log: merge heads diff --git a/pypy/module/micronumpy/concrete.py b/pypy/module/micronumpy/concrete.py --- a/pypy/module/micronumpy/concrete.py +++ b/pypy/module/micronumpy/concrete.py @@ -438,7 +438,7 @@ def __init__(self, shape, dtype, order, strides, backstrides, storage=lltype.nullptr(RAW_STORAGE), zero=True): gcstruct = V_OBJECTSTORE - self.flags = NPY.ARRAY_ALIGNED | NPY.ARRAY_WRITEABLE + flags = NPY.ARRAY_ALIGNED | NPY.ARRAY_WRITEABLE if storage == lltype.nullptr(RAW_STORAGE): length = support.product(shape) if dtype.num == NPY.OBJECT: @@ -446,15 +446,16 @@ gcstruct = _create_objectstore(storage, length, dtype.elsize) else: storage = dtype.itemtype.malloc(length * dtype.elsize, zero=zero) - self.flags |= NPY.ARRAY_OWNDATA + flags |= NPY.ARRAY_OWNDATA start = calc_start(shape, strides) ConcreteArrayNotOwning.__init__(self, shape, dtype, order, strides, backstrides, storage, start=start) self.gcstruct = gcstruct if is_c_contiguous(self): - self.flags |= NPY.ARRAY_C_CONTIGUOUS + flags |= NPY.ARRAY_C_CONTIGUOUS if is_f_contiguous(self): - self.flags |= NPY.ARRAY_F_CONTIGUOUS + flags |= NPY.ARRAY_F_CONTIGUOUS + self.flags = flags def __del__(self): if self.gcstruct: @@ -469,14 +470,15 @@ strides, backstrides, storage, start) self.orig_base = orig_base if isinstance(orig_base, W_NumpyObject): - self.flags = orig_base.get_flags() & NPY.ARRAY_ALIGNED - self.flags |= orig_base.get_flags() & NPY.ARRAY_WRITEABLE + flags = orig_base.get_flags() & NPY.ARRAY_ALIGNED + flags |= orig_base.get_flags() & NPY.ARRAY_WRITEABLE else: - self.flags = 0 + flags = 0 if is_c_contiguous(self): - self.flags |= NPY.ARRAY_C_CONTIGUOUS + flags |= NPY.ARRAY_C_CONTIGUOUS if is_f_contiguous(self): - self.flags |= NPY.ARRAY_F_CONTIGUOUS + flags |= NPY.ARRAY_F_CONTIGUOUS + self.flags = flags def base(self): return self.orig_base @@ -524,12 +526,13 @@ self.size = support.product(shape) * self.dtype.elsize self.start = start self.orig_arr = orig_arr - self.flags = parent.flags & NPY.ARRAY_ALIGNED - self.flags |= parent.flags & NPY.ARRAY_WRITEABLE + flags = parent.flags & NPY.ARRAY_ALIGNED + flags |= parent.flags & NPY.ARRAY_WRITEABLE if is_c_contiguous(self): - self.flags |= NPY.ARRAY_C_CONTIGUOUS + flags |= NPY.ARRAY_C_CONTIGUOUS if is_f_contiguous(self): - self.flags |= NPY.ARRAY_F_CONTIGUOUS + flags |= NPY.ARRAY_F_CONTIGUOUS + self.flags = flags def base(self): return self.orig_arr diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py --- a/pypy/objspace/std/newformat.py +++ b/pypy/objspace/std/newformat.py @@ -528,7 +528,7 @@ def _lit(self, s): if self.is_unicode: - return s.decode("ascii") + return s.decode("latin-1") else: return s @@ -586,8 +586,8 @@ thousands = "" grouping = "\xFF" # special value to mean 'stop' if self.is_unicode: - self._loc_dec = dec.decode("ascii") - self._loc_thousands = thousands.decode("ascii") + self._loc_dec = dec.decode("latin-1") + self._loc_thousands = thousands.decode("latin-1") else: self._loc_dec = dec self._loc_thousands = thousands @@ -725,7 +725,7 @@ out.append_multiple_char(fill_char[0], spec.n_lpadding) if spec.n_sign: if self.is_unicode: - sign = spec.sign.decode("ascii") + sign = spec.sign.decode("latin-1") else: sign = spec.sign out.append(sign) @@ -828,14 +828,14 @@ prefix = "0x" as_str = value.format(LONG_DIGITS[:base], prefix) if self.is_unicode: - return as_str.decode("ascii") + return as_str.decode("latin-1") return as_str def _int_to_base(self, base, value): if base == 10: s = str(value) if self.is_unicode: - return s.decode("ascii") + return s.decode("latin-1") return s # This part is slow. negative = value < 0 @@ -954,7 +954,7 @@ have_dec_point, to_remainder = self._parse_number(result, to_number) n_remainder = len(result) - to_remainder if self.is_unicode: - digits = result.decode("ascii") + digits = result.decode("latin-1") else: digits = result spec = self._calc_num_width(0, sign, to_number, n_digits, @@ -1059,8 +1059,8 @@ to_imag_number) if self.is_unicode: - re_num = re_num.decode("ascii") - im_num = im_num.decode("ascii") + re_num = re_num.decode("latin-1") + im_num = im_num.decode("latin-1") #set remainder, in CPython _parse_number sets this #using n_re_digits causes tests to fail _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit