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
d3c4853b
Commit
d3c4853b
authored
Feb 04, 2017
by
Steve Dower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #29416: Prevent infinite loop in pathlib.Path.mkdir
parent
7e10dbbd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
Lib/pathlib.py
Lib/pathlib.py
+1
-1
Lib/test/test_pathlib.py
Lib/test/test_pathlib.py
+11
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/pathlib.py
View file @
d3c4853b
...
...
@@ -1222,7 +1222,7 @@ class Path(PurePath):
if
not
exist_ok
or
not
self
.
is_dir
():
raise
except
OSError
as
e
:
if
e
.
errno
!=
ENOENT
:
if
e
.
errno
!=
ENOENT
or
self
.
parent
==
self
:
raise
self
.
parent
.
mkdir
(
parents
=
True
)
self
.
_accessor
.
mkdir
(
self
,
mode
)
...
...
Lib/test/test_pathlib.py
View file @
d3c4853b
...
...
@@ -1727,6 +1727,17 @@ class _BasePathTest(object):
self
.
assertTrue
(
p
.
exists
())
self
.
assertEqual
(
p
.
stat
().
st_ctime
,
st_ctime_first
)
@
only_nt
# XXX: not sure how to test this on POSIX
def
test_mkdir_with_unknown_drive
(
self
):
for
d
in
'ZYXWVUTSRQPONMLKJIHGFEDCBA'
:
p
=
self
.
cls
(
d
+
':
\
\
'
)
if
not
p
.
is_dir
():
break
else
:
self
.
skipTest
(
"cannot find a drive that doesn't exist"
)
with
self
.
assertRaises
(
OSError
):
(
p
/
'child'
/
'path'
).
mkdir
(
parents
=
True
)
def
test_mkdir_with_child_file
(
self
):
p
=
self
.
cls
(
BASE
,
'dirB'
,
'fileB'
)
self
.
assertTrue
(
p
.
exists
())
...
...
Misc/NEWS
View file @
d3c4853b
...
...
@@ -21,6 +21,8 @@ Extension Modules
Library
-------
- Issue #29416: Prevent infinite loop in pathlib.Path.mkdir
- Issue #29444: Fixed out-of-bounds buffer access in the group() method of
the match object. Based on patch by WGH.
...
...
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