diff -r 01676a4c16ff Lib/os.py --- a/Lib/os.py Sun Dec 08 10:06:04 2013 +0100 +++ b/Lib/os.py Sun Dec 08 13:07:51 2013 +0200 @@ -231,7 +231,7 @@ head, tail = path.split(head) if head and tail and not path.exists(head): try: - makedirs(head, mode, exist_ok) + makedirs(head, exist_ok=exist_ok) except FileExistsError: # be happy if someone already created the path pass diff -r 01676a4c16ff Lib/test/test_os.py --- a/Lib/test/test_os.py Sun Dec 08 10:06:04 2013 +0100 +++ b/Lib/test/test_os.py Sun Dec 08 13:07:51 2013 +0200 @@ -894,6 +894,18 @@ 'dir5', 'dir6') os.makedirs(path) + def test_mode(self): + with support.temp_umask(0o002): + base = support.TESTFN + parent = os.path.join(base, 'dir1') + path = os.path.join(parent, 'dir2') + os.makedirs(path, 0o555) + self.assertTrue(os.path.exists(path)) + self.assertTrue(os.path.isdir(path)) + if os.name != 'nt': + self.assertEqual(stat.S_IMODE(os.stat(path).st_mode), 0o555) + self.assertEqual(stat.S_IMODE(os.stat(parent).st_mode), 0o775) + def test_exist_ok_existing_directory(self): path = os.path.join(support.TESTFN, 'dir1') mode = 0o777