Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r71146:45da6ce7a49e Date: 2014-05-01 14:11 -0400 http://bitbucket.org/pypy/pypy/changeset/45da6ce7a49e/
Log: merge heads diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -1415,10 +1415,10 @@ def _getarg_error(self, expected, w_obj): if self.is_none(w_obj): - name = "None" + e = oefmt(self.w_TypeError, "must be %s, not None", expected) else: - name = self.type(w_obj).get_module_type_name() - raise oefmt(self.w_TypeError, "must be %s, not %s", expected, name) + e = oefmt(self.w_TypeError, "must be %s, not %T", expected, w_obj) + raise e @specialize.arg(1) def getarg_w(self, code, w_obj): diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py --- a/pypy/interpreter/error.py +++ b/pypy/interpreter/error.py @@ -362,9 +362,9 @@ value = getattr(self, attr) if fmt == 'R': result = space.str_w(space.repr(value)) - elif fmt in 'NT': - if fmt == 'T': - value = space.type(value) + elif fmt == 'T': + result = space.type(value).get_module_type_name() + elif fmt == 'N': result = value.getname(space) else: result = str(value) @@ -404,7 +404,7 @@ %N - The result of w_arg.getname(space) %R - The result of space.str_w(space.repr(w_arg)) - %T - The result of space.type(w_arg).getname(space) + %T - The result of space.type(w_arg).get_module_type_name() """ if not len(args): diff --git a/pypy/module/_rawffi/test/test__rawffi.py b/pypy/module/_rawffi/test/test__rawffi.py --- a/pypy/module/_rawffi/test/test__rawffi.py +++ b/pypy/module/_rawffi/test/test__rawffi.py @@ -1084,27 +1084,27 @@ s = S(autofree=True) b = buffer(s) assert len(b) == 40 - b[4] = 'X' - b[:3] = 'ABC' - assert b[:6] == 'ABC\x00X\x00' + b[4] = b'X' + b[:3] = b'ABC' + assert b[:6] == b'ABC\x00X\x00' A = _rawffi.Array('c') a = A(10, autofree=True) - a[3] = 'x' + a[3] = b'x' b = buffer(a) assert len(b) == 10 - assert b[3] == 'x' - b[6] = 'y' - assert a[6] == 'y' - b[3:5] = 'zt' - assert a[3] == 'z' - assert a[4] == 't' + assert b[3] == b'x' + b[6] = b'y' + assert a[6] == b'y' + b[3:5] = b'zt' + assert a[3] == b'z' + assert a[4] == b't' b = memoryview(a) assert len(b) == 10 - assert b[3] == 'z' - b[3] = 'x' - assert b[3] == 'x' + assert b[3] == b'z' + b[3] = b'x' + assert b[3] == b'x' def test_union(self): import _rawffi diff --git a/pypy/module/cppyy/pythonify.py b/pypy/module/cppyy/pythonify.py --- a/pypy/module/cppyy/pythonify.py +++ b/pypy/module/cppyy/pythonify.py @@ -1,6 +1,7 @@ # NOT_RPYTHON # do not load cppyy here, see _init_pythonify() -import types, sys +import types +import sys # For now, keep namespaces and classes separate as namespaces are extensible @@ -11,7 +12,7 @@ def __getattr__(self, name): try: return get_pycppitem(self, name) # will cache on self - except Exception, e: + except Exception as e: raise AttributeError("%s object has no attribute '%s' (details: %s)" % (self, name, str(e))) @@ -302,7 +303,7 @@ return self._getitem__unchecked(idx) def python_style_sliceable_getitem(self, slice_or_idx): - if type(slice_or_idx) == types.SliceType: + if type(slice_or_idx) == slice: nseq = self.__class__() nseq += [python_style_getitem(self, i) \ for i in range(*slice_or_idx.indices(len(self)))] diff --git a/pypy/objspace/std/test/test_strbufobject.py b/pypy/objspace/std/test/test_strbufobject.py --- a/pypy/objspace/std/test/test_strbufobject.py +++ b/pypy/objspace/std/test/test_strbufobject.py @@ -45,9 +45,9 @@ assert len(t) == 4 def test_buffer(self): - s = 'a'.__add__('b') - assert buffer(s) == buffer('ab') - assert memoryview(s) == 'ab' + s = b'a'.__add__(b'b') + assert buffer(s) == buffer(b'ab') + assert memoryview(s) == b'ab' def test_add_strbuf(self): # make three strbuf objects diff --git a/rpython/translator/c/gcc/trackgcroot.py b/rpython/translator/c/gcc/trackgcroot.py --- a/rpython/translator/c/gcc/trackgcroot.py +++ b/rpython/translator/c/gcc/trackgcroot.py @@ -522,8 +522,6 @@ 'movnt', 'mfence', 'lfence', 'sfence', # bit manipulations 'bextr', - # invalid instruction - 'ud2', ]) # a partial list is hopefully good enough for now; it's all to support @@ -695,6 +693,9 @@ return self.visit_ret(line) return [] + def visit_ud2(self, line): + return InsnStop("ud2") # unreachable instruction + def visit_jmp(self, line): tablelabels = [] match = self.r_jmp_switch.match(line) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit