bpo-32690: Preserve order of locals() (#5379)
This commit is contained in:
parent
059f58ce93
commit
a4d0001256
@ -0,0 +1,2 @@
|
|||||||
|
The locals() dictionary now displays in the lexical order that variables
|
||||||
|
were defined. Previously, the order was reversed.
|
@ -791,7 +791,7 @@ map_to_dict(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values,
|
|||||||
assert(PyTuple_Check(map));
|
assert(PyTuple_Check(map));
|
||||||
assert(PyDict_Check(dict));
|
assert(PyDict_Check(dict));
|
||||||
assert(PyTuple_Size(map) >= nmap);
|
assert(PyTuple_Size(map) >= nmap);
|
||||||
for (j = nmap; --j >= 0; ) {
|
for (j=0; j < nmap; j++) {
|
||||||
PyObject *key = PyTuple_GET_ITEM(map, j);
|
PyObject *key = PyTuple_GET_ITEM(map, j);
|
||||||
PyObject *value = values[j];
|
PyObject *value = values[j];
|
||||||
assert(PyUnicode_Check(key));
|
assert(PyUnicode_Check(key));
|
||||||
@ -844,7 +844,7 @@ dict_to_map(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values,
|
|||||||
assert(PyTuple_Check(map));
|
assert(PyTuple_Check(map));
|
||||||
assert(PyDict_Check(dict));
|
assert(PyDict_Check(dict));
|
||||||
assert(PyTuple_Size(map) >= nmap);
|
assert(PyTuple_Size(map) >= nmap);
|
||||||
for (j = nmap; --j >= 0; ) {
|
for (j=0; j < nmap; j++) {
|
||||||
PyObject *key = PyTuple_GET_ITEM(map, j);
|
PyObject *key = PyTuple_GET_ITEM(map, j);
|
||||||
PyObject *value = PyObject_GetItem(dict, key);
|
PyObject *value = PyObject_GetItem(dict, key);
|
||||||
assert(PyUnicode_Check(key));
|
assert(PyUnicode_Check(key));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user