summaryrefslogtreecommitdiffstats
path: root/Lib/py_compile.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-05-08 19:52:21 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-05-08 19:52:21 (GMT)
commit25216baf3222e782fdeb5480b8692dc25dd7a97a (patch)
tree271e95412fb851e7d4dc4f52d7b628cd95a360a6 /Lib/py_compile.py
parente5da82ff4ca8bdd6c6abc0ff84710b6ea4b3b518 (diff)
downloadcpython-25216baf3222e782fdeb5480b8692dc25dd7a97a.zip
cpython-25216baf3222e782fdeb5480b8692dc25dd7a97a.tar.gz
cpython-25216baf3222e782fdeb5480b8692dc25dd7a97a.tar.bz2
Create __pycache__ dir when the pyc path is explicitly given
Patch from Arfrever Frehtes Taifersar Arahesis.
Diffstat (limited to 'Lib/py_compile.py')
-rw-r--r--Lib/py_compile.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index 03f2c62..111893e 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -123,11 +123,11 @@ def compile(file, cfile=None, dfile=None, doraise=False):
return
if cfile is None:
cfile = imp.cache_from_source(file)
- try:
- os.mkdir(os.path.dirname(cfile))
- except OSError as error:
- if error.errno != errno.EEXIST:
- raise
+ try:
+ os.makedirs(os.path.dirname(cfile))
+ except OSError as error:
+ if error.errno != errno.EEXIST:
+ raise
with open(cfile, 'wb') as fc:
fc.write(b'\0\0\0\0')
wr_long(fc, timestamp)