[pypy-commit] pypy py3k: os.listdir() == os.listdir('.')

amauryfa noreply at buildbot.pypy.org
Mon Nov 19 23:51:35 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r59004:9a64eaf9e16f
Date: 2012-11-19 20:02 +0100
http://bitbucket.org/pypy/pypy/changeset/9a64eaf9e16f/

Log:	os.listdir() == os.listdir('.')

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
@@ -1,4 +1,4 @@
-from pypy.interpreter.gateway import unwrap_spec
+from pypy.interpreter.gateway import unwrap_spec, WrappedDefault
 from pypy.rlib import rposix, objectmodel, rurandom
 from pypy.rlib.objectmodel import specialize
 from pypy.rlib.rarithmetic import r_longlong
@@ -539,6 +539,7 @@
         raise wrap_oserror(space, e)
 
 
+ at unwrap_spec(w_dirname=WrappedDefault(u"."))
 def listdir(space, w_dirname):
     """Return a list containing the names of the entries in the directory.
 
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
@@ -275,6 +275,10 @@
                           'file1',
                           'file2']
 
+    def test_listdir_default(self):
+        posix = self.posix
+        assert posix.listdir() == posix.listdir('.')
+
     def test_listdir_bytes(self):
         import sys
         bytes_dir = self.bytes_dir


More information about the pypy-commit mailing list