Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3.5 Changeset: r93278:e7bcb8094e51 Date: 2017-12-05 22:02 +0000 http://bitbucket.org/pypy/pypy/changeset/e7bcb8094e51/
Log: hg merge default diff --git a/lib_pypy/resource.py b/lib_pypy/resource.py --- a/lib_pypy/resource.py +++ b/lib_pypy/resource.py @@ -20,6 +20,7 @@ or via the attributes ru_utime, ru_stime, ru_maxrss, and so on.""" __metaclass__ = _structseq.structseqtype + name = "resource.struct_rusage" ru_utime = _structseq.structseqfield(0, "user time used") ru_stime = _structseq.structseqfield(1, "system time used") diff --git a/pypy/module/cpyext/test/test_codecs.py b/pypy/module/cpyext/test/test_codecs.py --- a/pypy/module/cpyext/test/test_codecs.py +++ b/pypy/module/cpyext/test/test_codecs.py @@ -11,5 +11,5 @@ w_encoded = space.call_method(w_encoder, 'encode', space.wrap(u'späm')) w_decoder = PyCodec_IncrementalDecoder(space, utf8, None) w_decoded = space.call_method(w_decoder, 'decode', w_encoded) - assert space.unwrap(w_decoded) == u'späm' + assert space.unicode_w(w_decoded) == u'späm' rffi.free_charp(utf8) diff --git a/pypy/module/cpyext/test/test_eval.py b/pypy/module/cpyext/test/test_eval.py --- a/pypy/module/cpyext/test/test_eval.py +++ b/pypy/module/cpyext/test/test_eval.py @@ -131,7 +131,7 @@ finally: rffi.free_charp(buf) w_a = space.getitem(w_globals, space.wrap("a")) - assert space.unwrap(w_a) == u'caf\xe9' + assert space.unicode_w(w_a) == u'caf\xe9' lltype.free(flags, flavor='raw') def test_run_file(self, space): diff --git a/pypy/module/cpyext/test/test_object.py b/pypy/module/cpyext/test/test_object.py --- a/pypy/module/cpyext/test/test_object.py +++ b/pypy/module/cpyext/test/test_object.py @@ -8,7 +8,7 @@ from pypy.module.cpyext.object import ( PyObject_IsTrue, PyObject_Not, PyObject_GetAttrString, PyObject_DelAttrString, PyObject_GetAttr, PyObject_DelAttr, - PyObject_GetItem, + PyObject_GetItem, PyObject_IsInstance, PyObject_IsSubclass, PyObject_AsFileDescriptor, PyObject_Hash) @@ -570,7 +570,7 @@ PyObject *a = PyTuple_GetItem(args, 0); PyObject *b = PyTuple_GetItem(args, 1); int res = PyObject_RichCompareBool(a, b, Py_EQ); - return PyLong_FromLong(res); + return PyLong_FromLong(res); """),]) a = float('nan') b = float('nan') diff --git a/pypy/module/cpyext/test/test_unicodeobject.py b/pypy/module/cpyext/test/test_unicodeobject.py --- a/pypy/module/cpyext/test/test_unicodeobject.py +++ b/pypy/module/cpyext/test/test_unicodeobject.py @@ -372,7 +372,7 @@ word = space.wrap(u'spam') array = rffi.cast(rffi.CWCHARP, PyUnicode_AsUnicode(space, word)) array2 = PyUnicode_AsUnicode(space, word) - for (i, char) in enumerate(space.unwrap(word)): + for (i, char) in enumerate(space.unicode_w(word)): assert array[i] == char assert array2[i] == char with raises_w(space, TypeError): @@ -409,12 +409,12 @@ def test_fromstring(self, space): s = rffi.str2charp(u'sp\x09m'.encode("utf-8")) w_res = PyUnicode_FromString(space, s) - assert space.unwrap(w_res) == u'sp\x09m' + assert space.unicode_w(w_res) == u'sp\x09m' res = PyUnicode_FromStringAndSize(space, s, 4) w_res = from_ref(space, res) Py_DecRef(space, res) - assert space.unwrap(w_res) == u'sp\x09m' + assert space.unicode_w(w_res) == u'sp\x09m' rffi.free_charp(s) def test_internfromstring(self, space): @@ -457,17 +457,17 @@ u = rffi.str2charp(u'sp\x134m'.encode("utf-8")) w_u = PyUnicode_DecodeUTF8(space, u, 5, None) assert space.type(w_u) is space.w_unicode - assert space.unwrap(w_u) == u'sp\x134m' + assert space.unicode_w(w_u) == u'sp\x134m' w_u = PyUnicode_DecodeUTF8(space, u, 2, None) assert space.type(w_u) is space.w_unicode - assert space.unwrap(w_u) == 'sp' + assert space.unicode_w(w_u) == 'sp' rffi.free_charp(u) def test_encode_utf8(self, space): u = rffi.unicode2wcharp(u'sp\x09m') w_s = PyUnicode_EncodeUTF8(space, u, 4, None) - assert space.unwrap(w_s) == u'sp\x09m'.encode('utf-8') + assert space.unicode_w(w_s) == u'sp\x09m'.encode('utf-8') rffi.free_wcharp(u) def test_encode_decimal(self, space): @@ -631,12 +631,12 @@ def test_decode(self, space): b_text = rffi.str2charp('caf\x82xx') b_encoding = rffi.str2charp('cp437') - assert space.unwrap( + assert space.unicode_w( PyUnicode_Decode(space, b_text, 4, b_encoding, None)) == u'caf\xe9' w_text = PyUnicode_FromEncodedObject(space, space.newbytes("test"), b_encoding, None) assert space.isinstance_w(w_text, space.w_unicode) - assert space.unwrap(w_text) == "test" + assert space.unicode_w(w_text) == "test" with raises_w(space, TypeError): PyUnicode_FromEncodedObject(space, space.wrap(u"test"), @@ -652,7 +652,8 @@ u_text = u'abcdefg' s_text = space.str_w(PyUnicode_AsEncodedString(space, space.wrap(u_text), null_charp, null_charp)) b_text = rffi.str2charp(s_text) - assert space.unwrap(PyUnicode_Decode(space, b_text, len(s_text), null_charp, null_charp)) == u_text + assert space.unicode_w(PyUnicode_Decode( + space, b_text, len(s_text), null_charp, null_charp)) == u_text with raises_w(space, TypeError): PyUnicode_FromEncodedObject( space, space.wrap(u_text), null_charp, None) @@ -769,7 +770,7 @@ def test_concat(self, space): w_res = PyUnicode_Concat(space, space.wrap(u'a'), space.wrap(u'b')) - assert space.unwrap(w_res) == u'ab' + assert space.unicode_w(w_res) == u'ab' def test_copy(self, space): w_x = space.wrap(u"abcd\u0660") @@ -840,29 +841,30 @@ w_format = space.wrap(u'hi %s') w_args = space.wrap((u'test',)) w_formated = PyUnicode_Format(space, w_format, w_args) - assert space.unwrap(w_formated) == space.unwrap(space.mod(w_format, w_args)) + assert (space.unicode_w(w_formated) == + space.unicode_w(space.mod(w_format, w_args))) def test_join(self, space): w_sep = space.wrap(u'<sep>') w_seq = space.wrap([u'a', u'b']) w_joined = PyUnicode_Join(space, w_sep, w_seq) - assert space.unwrap(w_joined) == u'a<sep>b' + assert space.unicode_w(w_joined) == u'a<sep>b' def test_fromordinal(self, space): w_char = PyUnicode_FromOrdinal(space, 65) - assert space.unwrap(w_char) == u'A' + assert space.unicode_w(w_char) == u'A' w_char = PyUnicode_FromOrdinal(space, 0) - assert space.unwrap(w_char) == u'\0' + assert space.unicode_w(w_char) == u'\0' w_char = PyUnicode_FromOrdinal(space, 0xFFFF) - assert space.unwrap(w_char) == u'\uFFFF' + assert space.unicode_w(w_char) == u'\uFFFF' def test_replace(self, space): w_str = space.wrap(u"abababab") w_substr = space.wrap(u"a") w_replstr = space.wrap(u"z") - assert u"zbzbabab" == space.unwrap( + assert u"zbzbabab" == space.unicode_w( PyUnicode_Replace(space, w_str, w_substr, w_replstr, 2)) - assert u"zbzbzbzb" == space.unwrap( + assert u"zbzbzbzb" == space.unicode_w( PyUnicode_Replace(space, w_str, w_substr, w_replstr, -1)) def test_tailmatch(self, space): diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -29,12 +29,20 @@ pdir.join('file2').write("test2") pdir.join('another_longer_file_name').write("test3") mod.pdir = pdir - bytes_dir = udir.ensure('fi\xc5\x9fier.txt', dir=True) + if sys.platform == 'darwin': + # see issue https://bugs.python.org/issue31380 + bytes_dir = udir.ensure('fixc5x9fier.txt', dir=True) + file_name = 'cafxe9' + surrogate_name = 'foo' + else: + bytes_dir = udir.ensure('fi\xc5\x9fier.txt', dir=True) + file_name = 'caf\xe9' + surrogate_name = 'foo\x80' bytes_dir.join('somefile').write('who cares?') - bytes_dir.join('caf\xe9').write('who knows?') + bytes_dir.join(file_name).write('who knows?') mod.bytes_dir = bytes_dir # an escaped surrogate - mod.esurrogate_dir = udir.ensure('foo\x80', dir=True) + mod.esurrogate_dir = udir.ensure(surrogate_name, dir=True) # in applevel tests, os.stat uses the CPython os.stat. # Be sure to return times with full precision diff --git a/pypy/module/unicodedata/test/test_hyp.py b/pypy/module/unicodedata/test/test_hyp.py --- a/pypy/module/unicodedata/test/test_hyp.py +++ b/pypy/module/unicodedata/test/test_hyp.py @@ -10,7 +10,7 @@ def normalize(s): w_s = space.newunicode(s) w_res = ucd.normalize(space, NF_code, w_s) - return space.unwrap(w_res) + return space.unicode_w(w_res) return normalize all_forms = ['NFC', 'NFD', 'NFKC', 'NFKD'] _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit