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
2ec8f9bf
Commit
2ec8f9bf
authored
May 28, 2015
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Plain Diff
merge 3.5 (#11205)
parents
26f7057b
ee85339c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
113 deletions
+127
-113
Lib/importlib/_bootstrap_external.py
Lib/importlib/_bootstrap_external.py
+2
-1
Lib/test/test_compile.py
Lib/test/test_compile.py
+11
-0
Misc/NEWS
Misc/NEWS
+2
-0
Python/ceval.c
Python/ceval.c
+2
-2
Python/compile.c
Python/compile.c
+2
-2
Python/importlib_external.h
Python/importlib_external.h
+108
-108
No files found.
Lib/importlib/_bootstrap_external.py
View file @
2ec8f9bf
...
...
@@ -221,12 +221,13 @@ _code_type = type(_write_atomic.__code__)
# Python 3.4rc2 3310 (alter __qualname__ computation)
# Python 3.5a0 3320 (matrix multiplication operator)
# Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations)
# Python 3.5b2 3340 (fix dictionary display evaluation order #11205)
#
# MAGIC must change whenever the bytecode emitted by the compiler may no
# longer be understood by older implementations of the eval loop (usually
# due to the addition of new opcodes).
MAGIC_NUMBER
=
(
33
3
0
).
to_bytes
(
2
,
'little'
)
+
b'
\
r
\
n
'
MAGIC_NUMBER
=
(
33
4
0
).
to_bytes
(
2
,
'little'
)
+
b'
\
r
\
n
'
_RAW_MAGIC_NUMBER
=
int
.
from_bytes
(
MAGIC_NUMBER
,
'little'
)
# For import.c
_PYCACHE
=
'__pycache__'
...
...
Lib/test/test_compile.py
View file @
2ec8f9bf
...
...
@@ -461,6 +461,17 @@ if 1:
ast
.
body
=
[
_ast
.
BoolOp
()]
self
.
assertRaises
(
TypeError
,
compile
,
ast
,
'<ast>'
,
'exec'
)
def
test_dict_evaluation_order
(
self
):
i
=
0
def
f
():
nonlocal
i
i
+=
1
return
i
d
=
{
f
():
f
(),
f
():
f
()}
self
.
assertEqual
(
d
,
{
1
:
2
,
3
:
4
})
@
support
.
cpython_only
def
test_same_filename_used
(
self
):
s
=
"""def f(): pass
\
n
def g(): pass"""
...
...
Misc/NEWS
View file @
2ec8f9bf
...
...
@@ -22,6 +22,8 @@ Release date: 2015-07-05
Core
and
Builtins
-----------------
-
Issue
#
11205
:
In
dictionary
displays
,
evaluate
the
key
before
the
value
.
-
Issue
#
24285
:
Fixed
regression
that
prevented
importing
extension
modules
from
inside
packages
.
Patch
by
Petr
Viktorin
.
...
...
Python/ceval.c
View file @
2ec8f9bf
...
...
@@ -2584,8 +2584,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
goto
error
;
while
(
--
oparg
>=
0
)
{
int
err
;
PyObject
*
key
=
TOP
();
PyObject
*
value
=
SECOND
();
PyObject
*
value
=
TOP
();
PyObject
*
key
=
SECOND
();
STACKADJ
(
-
2
);
err
=
PyDict_SetItem
(
map
,
key
,
value
);
Py_DECREF
(
value
);
...
...
Python/compile.c
View file @
2ec8f9bf
...
...
@@ -3138,8 +3138,8 @@ compiler_dict(struct compiler *c, expr_ty e)
containers
++
;
}
else
{
VISIT
(
c
,
expr
,
(
expr_ty
)
asdl_seq_GET
(
e
->
v
.
Dict
.
values
,
i
));
VISIT
(
c
,
expr
,
(
expr_ty
)
asdl_seq_GET
(
e
->
v
.
Dict
.
keys
,
i
));
VISIT
(
c
,
expr
,
(
expr_ty
)
asdl_seq_GET
(
e
->
v
.
Dict
.
values
,
i
));
elements
++
;
}
}
...
...
@@ -3287,8 +3287,8 @@ compiler_call_helper(struct compiler *c,
}
else
if
(
nsubkwargs
)
{
/* A keyword argument and we already have a dict. */
VISIT
(
c
,
expr
,
kw
->
value
);
ADDOP_O
(
c
,
LOAD_CONST
,
kw
->
arg
,
consts
);
VISIT
(
c
,
expr
,
kw
->
value
);
nseen
++
;
}
else
{
...
...
Python/importlib_external.h
View file @
2ec8f9bf
This diff is collapsed.
Click to expand it.
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