Author: Alex Gaynor <alex.gay...@gmail.com> Branch: Changeset: r52262:3d143ab5260b Date: 2012-02-08 21:09 -0500 http://bitbucket.org/pypy/pypy/changeset/3d143ab5260b/
Log: merged upstream diff --git a/pypy/doc/release-1.8.0.rst b/pypy/doc/release-1.8.0.rst --- a/pypy/doc/release-1.8.0.rst +++ b/pypy/doc/release-1.8.0.rst @@ -6,7 +6,7 @@ release brings a lot of bugfixes, and performance and memory improvements over the 1.7 release. The main highlight of the release is the introduction of list strategies which makes homogenous lists more efficient both in terms -of performance and memory. This release also upgrades us from Python 2.7.1 compatibility to 2.7.2, you can read the details of this at XXX. Otherwise it's "business as usual" in the sense +of performance and memory. This release also upgrades us from Python 2.7.1 compatibility to 2.7.2. Otherwise it's "business as usual" in the sense that performance improved roughly 10% on average since the previous release. You can download the PyPy 1.8 release here: @@ -35,7 +35,7 @@ strategies for unicode and string lists. * As usual, numerous performance improvements. There are many examples - of python constructs that now should behave faster; too many to list them. + of python constructs that now should be faster; too many to list them. * Bugfixes and compatibility fixes with CPython. @@ -67,12 +67,16 @@ It's also probably worth noting, we're considering donations for the STM project. +* Standard library upgrade from 2.7.1 to 2.7.2. + Ongoing work ============ As usual, there is quite a bit of ongoing work that either didn't make it to the release or is not ready yet. Highlights include: +* Non-x86 backends for the JIT: ARMv7 (almost ready) and PPC64 (in progress) + * Specialized type instances - allocate instances as efficient as C structs, including type specialization diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -543,10 +543,16 @@ dirname = FileEncoder(space, w_dirname) result = rposix.listdir(dirname) w_fs_encoding = getfilesystemencoding(space) - result_w = [ - space.call_method(space.wrap(s), "decode", w_fs_encoding) - for s in result - ] + len_result = len(result) + result_w = [None] * len_result + for i in range(len_result): + w_bytes = space.wrap(result[i]) + try: + result_w[i] = space.call_method(w_bytes, + "decode", w_fs_encoding) + except OperationError, e: + # fall back to the original byte string + result_w[i] = w_bytes else: dirname = space.str0_w(w_dirname) result = rposix.listdir(dirname) 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,6 +29,7 @@ mod.pdir = pdir unicode_dir = udir.ensure('fi\xc5\x9fier.txt', dir=True) unicode_dir.join('somefile').write('who cares?') + unicode_dir.join('caf\xe9').write('who knows?') mod.unicode_dir = unicode_dir # in applevel tests, os.stat uses the CPython os.stat. @@ -308,14 +309,22 @@ 'file2'] def test_listdir_unicode(self): + import sys unicode_dir = self.unicode_dir if unicode_dir is None: skip("encoding not good enough") posix = self.posix result = posix.listdir(unicode_dir) - result.sort() - assert result == [u'somefile'] - assert type(result[0]) is unicode + typed_result = [(type(x), x) for x in result] + assert (unicode, u'somefile') in typed_result + try: + u = "caf\xe9".decode(sys.getfilesystemencoding()) + except UnicodeDecodeError: + # Could not decode, listdir returned the byte string + assert (str, "caf\xe9") in typed_result + else: + assert (unicode, u) in typed_result + def test_access(self): pdir = self.pdir + '/file1' _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit