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
d5d77aac
Commit
d5d77aac
authored
Jul 05, 2015
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set items in dict displays from left to right (closes #24569)
parent
1554b178
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
Lib/test/test_unpack_ex.py
Lib/test/test_unpack_ex.py
+3
-0
Misc/NEWS
Misc/NEWS
+2
-0
Python/ceval.c
Python/ceval.c
+9
-6
No files found.
Lib/test/test_unpack_ex.py
View file @
d5d77aac
...
...
@@ -128,6 +128,9 @@ Dict display element unpacking
... for i in range(1000)) + "}"))
1000
>>> {0:1, **{0:2}, 0:3, 0:4}
{0: 4}
List comprehension element unpacking
>>> a, b, c = [0, 1, 2], 3, 4
...
...
Misc/NEWS
View file @
d5d77aac
...
...
@@ -10,6 +10,8 @@ What's New in Python 3.5.0 beta 4?
Core and Builtins
-----------------
- Issue #24569: Make PEP 448 dictionary evaluation more consistent.
Library
-------
...
...
Python/ceval.c
View file @
d5d77aac
...
...
@@ -2561,22 +2561,25 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
}
TARGET
(
BUILD_MAP
)
{
int
i
;
PyObject
*
map
=
_PyDict_NewPresized
((
Py_ssize_t
)
oparg
);
if
(
map
==
NULL
)
goto
error
;
while
(
--
oparg
>=
0
)
{
for
(
i
=
oparg
;
i
>
0
;
i
--
)
{
int
err
;
PyObject
*
value
=
TOP
();
PyObject
*
key
=
SECOND
();
STACKADJ
(
-
2
);
PyObject
*
key
=
PEEK
(
2
*
i
);
PyObject
*
value
=
PEEK
(
2
*
i
-
1
);
err
=
PyDict_SetItem
(
map
,
key
,
value
);
Py_DECREF
(
value
);
Py_DECREF
(
key
);
if
(
err
!=
0
)
{
Py_DECREF
(
map
);
goto
error
;
}
}
while
(
oparg
--
)
{
Py_DECREF
(
POP
());
Py_DECREF
(
POP
());
}
PUSH
(
map
);
DISPATCH
();
}
...
...
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