]> granicus.if.org Git - python/commitdiff
Issue #13374: Deprecate os.getcwdb() on Windows
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 16 Nov 2011 22:43:07 +0000 (23:43 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 16 Nov 2011 22:43:07 +0000 (23:43 +0100)
Lib/test/test_genericpath.py
Lib/test/test_os.py
Modules/posixmodule.c

index b618d45519dccc771a6c93c78ca10121bea89011..ebb8396f186daa531734e50dff8d87024bcfc726 100644 (file)
@@ -264,8 +264,10 @@ class CommonTest(GenericTest):
             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"))
index a3b99a3366e182a0cd5474e4173eb69210155a31..b9e2f320082a7fa0175049d94fedf35e8a5f5d90 100644 (file)
@@ -1638,6 +1638,7 @@ class Win32DeprecatedBytesAPI(unittest.TestCase):
                 (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),
index 9012e3979401fb4bb207d28c3dee3de5fe0f4635..078010b8f003ccc5b9ef2b2ccecb824de5ed4dab 100644 (file)
@@ -2410,6 +2410,9 @@ posix_getcwd(int use_bytes)
         if (wbuf2 != wbuf) free(wbuf2);
         return resobj;
     }
+
+    if (win32_warn_bytes_api())
+        return NULL;
 #endif
 
     Py_BEGIN_ALLOW_THREADS