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
22b9b379
Commit
22b9b379
authored
Nov 28, 2011
by
Meador Inge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12618: py_compile cannot create files in current directory
Initial patch by Sjoerd de Vries.
parent
7be8f68d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
1 deletion
+16
-1
Lib/py_compile.py
Lib/py_compile.py
+3
-1
Lib/test/test_py_compile.py
Lib/test/test_py_compile.py
+9
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/py_compile.py
View file @
22b9b379
...
@@ -130,7 +130,9 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1):
...
@@ -130,7 +130,9 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1):
else
:
else
:
cfile
=
imp
.
cache_from_source
(
file
)
cfile
=
imp
.
cache_from_source
(
file
)
try
:
try
:
os
.
makedirs
(
os
.
path
.
dirname
(
cfile
))
dirname
=
os
.
path
.
dirname
(
cfile
)
if
dirname
:
os
.
makedirs
(
dirname
)
except
OSError
as
error
:
except
OSError
as
error
:
if
error
.
errno
!=
errno
.
EEXIST
:
if
error
.
errno
!=
errno
.
EEXIST
:
raise
raise
...
...
Lib/test/test_py_compile.py
View file @
22b9b379
...
@@ -39,6 +39,15 @@ class PyCompileTests(unittest.TestCase):
...
@@ -39,6 +39,15 @@ class PyCompileTests(unittest.TestCase):
py_compile
.
compile
(
self
.
source_path
)
py_compile
.
compile
(
self
.
source_path
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
cache_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_cwd
(
self
):
cwd
=
os
.
getcwd
()
os
.
chdir
(
self
.
directory
)
py_compile
.
compile
(
os
.
path
.
basename
(
self
.
source_path
),
os
.
path
.
basename
(
self
.
pyc_path
))
os
.
chdir
(
cwd
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pyc_path
))
self
.
assertFalse
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_relative_path
(
self
):
def
test_relative_path
(
self
):
py_compile
.
compile
(
os
.
path
.
relpath
(
self
.
source_path
),
py_compile
.
compile
(
os
.
path
.
relpath
(
self
.
source_path
),
os
.
path
.
relpath
(
self
.
pyc_path
))
os
.
path
.
relpath
(
self
.
pyc_path
))
...
...
Misc/ACKS
View file @
22b9b379
...
@@ -941,6 +941,7 @@ Kannan Vijayan
...
@@ -941,6 +941,7 @@ Kannan Vijayan
Kurt Vile
Kurt Vile
Norman Vine
Norman Vine
Frank Visser
Frank Visser
Sjoerd de Vries
Niki W. Waibel
Niki W. Waibel
Wojtek Walczak
Wojtek Walczak
Charles Waldman
Charles Waldman
...
...
Misc/NEWS
View file @
22b9b379
...
@@ -83,6 +83,9 @@ Core and Builtins
...
@@ -83,6 +83,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12618: Fix a bug that prevented py_compile from creating byte
compiled files in the current directory. Initial patch by Sjoerd de Vries.
- Issue #13444: When stdout has been closed explicitly, we should not attempt
- Issue #13444: When stdout has been closed explicitly, we should not attempt
to flush it at shutdown and print an error.
to flush it at shutdown and print an error.
...
...
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