summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-16 22:43:07 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-16 22:43:07 (GMT)
commitf7c5ae225725893fe1cc0bb2b97d89182eac2c2e (patch)
treec74c198e5ca630a58850e0f5ddc6108e7ab252d7
parent345379a7f8ae2d8f5151eacc0eaa9f3902e76c8e (diff)
downloadcpython-f7c5ae225725893fe1cc0bb2b97d89182eac2c2e.zip
cpython-f7c5ae225725893fe1cc0bb2b97d89182eac2c2e.tar.gz
cpython-f7c5ae225725893fe1cc0bb2b97d89182eac2c2e.tar.bz2
Issue #13374: Deprecate os.getcwdb() on Windows
-rw-r--r--Lib/test/test_genericpath.py6
-rw-r--r--Lib/test/test_os.py1
-rw-r--r--Modules/posixmodule.c3
3 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index b618d45..ebb8396 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -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"))
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index a3b99a3..b9e2f32 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -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),
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 9012e39..078010b 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -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