mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Issue #12618: py_compile cannot create files in current directory
Initial patch by Sjoerd de Vries.
This commit is contained in:
parent
7be8f68d37
commit
22b9b37915
4 changed files with 16 additions and 1 deletions
|
@ -130,7 +130,9 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1):
|
|||
else:
|
||||
cfile = imp.cache_from_source(file)
|
||||
try:
|
||||
os.makedirs(os.path.dirname(cfile))
|
||||
dirname = os.path.dirname(cfile)
|
||||
if dirname:
|
||||
os.makedirs(dirname)
|
||||
except OSError as error:
|
||||
if error.errno != errno.EEXIST:
|
||||
raise
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue