Kaydet (Commit) f7c5ae22 authored tarafından Victor Stinner's avatar Victor Stinner

Issue #13374: Deprecate os.getcwdb() on Windows

üst 345379a7
...@@ -264,8 +264,10 @@ class CommonTest(GenericTest): ...@@ -264,8 +264,10 @@ class CommonTest(GenericTest):
self.assertIn(b"foo", self.pathmodule.abspath(b"foo")) self.assertIn(b"foo", self.pathmodule.abspath(b"foo"))
# Abspath returns bytes when the arg is bytes # Abspath returns bytes when the arg is bytes
for path in (b'', b'foo', b'f\xf2\xf2', b'/foo', b'C:\\'): with warnings.catch_warnings():
self.assertIsInstance(self.pathmodule.abspath(path), bytes) 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): def test_realpath(self):
self.assertIn("foo", self.pathmodule.realpath("foo")) self.assertIn("foo", self.pathmodule.realpath("foo"))
......
...@@ -1638,6 +1638,7 @@ class Win32DeprecatedBytesAPI(unittest.TestCase): ...@@ -1638,6 +1638,7 @@ class Win32DeprecatedBytesAPI(unittest.TestCase):
(os.access, filename, os.R_OK), (os.access, filename, os.R_OK),
(os.chdir, filename), (os.chdir, filename),
(os.chmod, filename, 0o777), (os.chmod, filename, 0o777),
(os.getcwdb,),
(os.link, filename, filename), (os.link, filename, filename),
(os.listdir, filename), (os.listdir, filename),
(os.lstat, filename), (os.lstat, filename),
......
...@@ -2410,6 +2410,9 @@ posix_getcwd(int use_bytes) ...@@ -2410,6 +2410,9 @@ posix_getcwd(int use_bytes)
if (wbuf2 != wbuf) free(wbuf2); if (wbuf2 != wbuf) free(wbuf2);
return resobj; return resobj;
} }
if (win32_warn_bytes_api())
return NULL;
#endif #endif
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment