Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5e02af49
Commit
5e02af49
authored
Nov 20, 2015
by
Martin Panter
Browse files
Options
Browse Files
Download
Plain Diff
Issue #25583: Merge makedirs fix from 3.5
parents
13d9b86d
97cabb9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
Lib/os.py
Lib/os.py
+5
-3
Lib/test/test_os.py
Lib/test/test_os.py
+3
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/os.py
View file @
5e02af49
...
...
@@ -230,7 +230,7 @@ def makedirs(name, mode=0o777, exist_ok=False):
try
:
makedirs
(
head
,
mode
,
exist_ok
)
except
FileExistsError
:
#
be happy if someone already
created the path
#
Defeats race condition when another thread
created the path
pass
cdir
=
curdir
if
isinstance
(
tail
,
bytes
):
...
...
@@ -239,8 +239,10 @@ def makedirs(name, mode=0o777, exist_ok=False):
return
try
:
mkdir
(
name
,
mode
)
except
OSError
as
e
:
if
not
exist_ok
or
e
.
errno
!=
errno
.
EEXIST
or
not
path
.
isdir
(
name
):
except
OSError
:
# Cannot rely on checking for EEXIST, since the operating system
# could give priority to other errors like EACCES or EROFS
if
not
exist_ok
or
not
path
.
isdir
(
name
):
raise
def
removedirs
(
name
):
...
...
Lib/test/test_os.py
View file @
5e02af49
...
...
@@ -1039,6 +1039,9 @@ class MakedirTests(unittest.TestCase):
os
.
makedirs
(
path
,
mode
=
mode
,
exist_ok
=
True
)
os
.
umask
(
old_mask
)
# Issue #25583: A drive root could raise PermissionError on Windows
os
.
makedirs
(
os
.
path
.
abspath
(
'/'
),
exist_ok
=
True
)
def
test_exist_ok_s_isgid_directory
(
self
):
path
=
os
.
path
.
join
(
support
.
TESTFN
,
'dir1'
)
S_ISGID
=
stat
.
S_ISGID
...
...
Misc/NEWS
View file @
5e02af49
...
...
@@ -429,6 +429,9 @@ Core and Builtins
Library
-------
-
Issue
#
25583
:
Avoid
incorrect
errors
raised
by
os
.
makedirs
(
exist_ok
=
True
)
when
the
OS
gives
priority
to
errors
such
as
EACCES
over
EEXIST
.
-
Issue
#
25590
:
In
the
Readline
completer
,
only
call
getattr
()
once
per
attribute
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment