[Python-checkins] cpython: Issue #13374: Deprecate os.getcwdb() on Windows

victor.stinner python-checkins at python.org
Wed Nov 16 23:42:31 CET 2011


http://hg.python.org/cpython/rev/5f239b0ba819
changeset:   73590:5f239b0ba819
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Wed Nov 16 23:43:07 2011 +0100
summary:
  Issue #13374: Deprecate os.getcwdb() on Windows

files:
  Lib/test/test_genericpath.py |  6 ++++--
  Lib/test/test_os.py          |  1 +
  Modules/posixmodule.c        |  3 +++
  3 files changed, 8 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -264,8 +264,10 @@
             self.assertIn(b"foo", self.pathmodule.abspath(b"foo"))
 
         # Abspath returns bytes when the arg is bytes
-        for path in (b'', b'foo', b'f\xf2\xf2', b'/foo', b'C:\\'):
-            self.assertIsInstance(self.pathmodule.abspath(path), bytes)
+        with warnings.catch_warnings():
+            warnings.simplefilter("ignore", DeprecationWarning)
+            for path in (b'', b'foo', b'f\xf2\xf2', b'/foo', b'C:\\'):
+                self.assertIsInstance(self.pathmodule.abspath(path), bytes)
 
     def test_realpath(self):
         self.assertIn("foo", self.pathmodule.realpath("foo"))
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1638,6 +1638,7 @@
                 (os.access, filename, os.R_OK),
                 (os.chdir, filename),
                 (os.chmod, filename, 0o777),
+                (os.getcwdb,),
                 (os.link, filename, filename),
                 (os.listdir, filename),
                 (os.lstat, filename),
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2410,6 +2410,9 @@
         if (wbuf2 != wbuf) free(wbuf2);
         return resobj;
     }
+
+    if (win32_warn_bytes_api())
+        return NULL;
 #endif
 
     Py_BEGIN_ALLOW_THREADS

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list