summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-07-25 15:16:40 (GMT)
committerFred Drake <fdrake@acm.org>2000-07-25 15:16:40 (GMT)
commit9f2550f58166679a04b651f3d96748b1c9607497 (patch)
tree242cb6f0de077fb0dbc610da205a7db27dfe01d2 /Lib/os.py
parent0365180a74904c1b6ac186e9edb923afed59aa84 (diff)
downloadcpython-9f2550f58166679a04b651f3d96748b1c9607497.zip
cpython-9f2550f58166679a04b651f3d96748b1c9607497.tar.gz
cpython-9f2550f58166679a04b651f3d96748b1c9607497.tar.bz2
makedirs(), removedirs(): If the tail of the path is empty, do a second
split so the logic does not fail in corner cases. This closes bug #407.
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 8e1e4f0..59c3895 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -126,6 +126,8 @@ def makedirs(name, mode=0777):
"""
head, tail = path.split(name)
+ if not tail:
+ head, tail = path.split(head)
if head and tail and not path.exists(head):
makedirs(head, mode)
mkdir(name, mode)
@@ -143,6 +145,8 @@ def removedirs(name):
"""
rmdir(name)
head, tail = path.split(name)
+ if not tail:
+ head, tail = path.split(head)
while head and tail:
try:
rmdir(head)