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
8ee9edbf
Commit
8ee9edbf
authored
Sep 14, 2016
by
Berker Peksag
Browse files
Options
Browse Files
Download
Plain Diff
Issue #28131: Merge from 3.5
parents
f6365e38
4aa74c42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
Lib/test/test_zipimport.py
Lib/test/test_zipimport.py
+13
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/zipimport.c
Modules/zipimport.c
+1
-1
No files found.
Lib/test/test_zipimport.py
View file @
8ee9edbf
...
...
@@ -532,6 +532,19 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
"some.data"
:
(
NOW
,
"some data"
)}
self
.
doTest
(
pyc_ext
,
files
,
TESTMOD
)
def
testDefaultOptimizationLevel
(
self
):
# zipimport should use the default optimization level (#28131)
src
=
"""if 1: # indent hack
def test(val):
assert(val)
return val
\
n
"""
files
=
{
TESTMOD
+
'.py'
:
(
NOW
,
src
)}
self
.
makeZip
(
files
)
sys
.
path
.
insert
(
0
,
TEMP_ZIP
)
mod
=
importlib
.
import_module
(
TESTMOD
)
self
.
assertEqual
(
mod
.
test
(
1
),
1
)
self
.
assertRaises
(
AssertionError
,
mod
.
test
,
False
)
def
testImport_WithStuff
(
self
):
# try importing from a zipfile which contains additional
# stuff at the beginning of the file
...
...
Misc/NEWS
View file @
8ee9edbf
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2
Core and Builtins
-----------------
- Issue #28131: Fix a regression in zipimport'
s
compile_source
().
zipimport
should
use
the
same
optimization
level
as
the
interpreter
.
-
Issue
#
28126
:
Replace
Py_MEMCPY
with
memcpy
().
Visual
Studio
can
properly
optimize
memcpy
().
...
...
Modules/zipimport.c
View file @
8ee9edbf
...
...
@@ -1370,7 +1370,7 @@ compile_source(PyObject *pathname, PyObject *source)
}
code
=
Py_CompileStringObject
(
PyBytes_AsString
(
fixed_source
),
pathname
,
Py_file_input
,
NULL
,
1
);
pathname
,
Py_file_input
,
NULL
,
-
1
);
Py_DECREF
(
fixed_source
);
return
code
;
...
...
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