Author: Philip Jenvey <pjen...@underboss.org> Branch: Changeset: r71144:4cc9b702d120 Date: 2014-05-01 10:52 -0700 http://bitbucket.org/pypy/pypy/changeset/4cc9b702d120/
Log: merge upstream 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 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit