summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2013-02-12 14:14:17 (GMT)
committerGiampaolo Rodola' <g.rodola@gmail.com>2013-02-12 14:14:17 (GMT)
commit0166a283f65b08ee2dddb1b075f86862b8c7e3e4 (patch)
treef319f122b4865fcba24d86fd4d48f3f923cfea8b /Lib/os.py
parentb071d4f3da8db02dc5b355590f1f909896592ec3 (diff)
downloadcpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.zip
cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.gz
cpython-0166a283f65b08ee2dddb1b075f86862b8c7e3e4.tar.bz2
modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.)
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 659f3cc..5f35f4c 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -232,10 +232,9 @@ def makedirs(name, mode=0o777, exist_ok=False):
if head and tail and not path.exists(head):
try:
makedirs(head, mode, exist_ok)
- except OSError as e:
+ except FileExistsError:
# be happy if someone already created the path
- if e.errno != errno.EEXIST:
- raise
+ pass
cdir = curdir
if isinstance(tail, bytes):
cdir = bytes(curdir, 'ASCII')