mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-37412: os.getcwdb() now uses UTF-8 on Windows (GH-14396)
The os.getcwdb() function now uses the UTF-8 encoding on Windows, rather than the ANSI code page: see PEP 529 for the rationale. The function is no longer deprecated on Windows. os.getcwd() and os.getcwdb() now detect integer overflow on memory allocations. On Unix, these functions properly report MemoryError on memory allocation failure.
This commit is contained in:
parent
c6a2320e87
commit
689830ee62
5 changed files with 88 additions and 59 deletions
|
@ -82,6 +82,17 @@ def create_file(filename, content=b'content'):
|
|||
fp.write(content)
|
||||
|
||||
|
||||
class MiscTests(unittest.TestCase):
|
||||
def test_getcwd(self):
|
||||
cwd = os.getcwd()
|
||||
self.assertIsInstance(cwd, str)
|
||||
|
||||
def test_getcwdb(self):
|
||||
cwd = os.getcwdb()
|
||||
self.assertIsInstance(cwd, bytes)
|
||||
self.assertEqual(os.fsdecode(cwd), os.getcwd())
|
||||
|
||||
|
||||
# Tests creating TESTFN
|
||||
class FileTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue