Author: Armin Rigo <[email protected]>
Branch: py3k
Changeset: r86396:3951644b86e8
Date: 2016-08-22 10:22 +0200
http://bitbucket.org/pypy/pypy/changeset/3951644b86e8/

Log:    os.listdir(None)

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
@@ -838,8 +838,7 @@
             raise wrap_oserror(space, e)
 
 
-@unwrap_spec(w_path=WrappedDefault(u"."))
-def listdir(space, w_path):
+def listdir(space, w_path=None):
     """listdir(path='.') -> list_of_filenames
 
 Return a list containing the names of the files in the directory.
@@ -852,6 +851,8 @@
 On some platforms, path may also be specified as an open file descriptor;
   the file descriptor must refer to a directory.
   If this functionality is unavailable, using it raises NotImplementedError."""
+    if space.is_none(w_path):
+        w_path = space.newunicode(u".")
     if space.isinstance_w(w_path, space.w_bytes):
         dirname = space.str0_w(w_path)
         try:
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
@@ -313,7 +313,7 @@
 
     def test_listdir_default(self):
         posix = self.posix
-        assert posix.listdir() == posix.listdir('.')
+        assert posix.listdir() == posix.listdir('.') == posix.listdir(None)
 
     def test_listdir_bytes(self):
         import sys
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to