mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
dict_repr: Reuse one of the int vars (minor code simplification).
This commit is contained in:
parent
52e155e31b
commit
c605784174
1 changed files with 3 additions and 3 deletions
|
@ -809,7 +809,7 @@ dict_print(register dictobject *mp, register FILE *fp, register int flags)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dict_repr(dictobject *mp)
|
dict_repr(dictobject *mp)
|
||||||
{
|
{
|
||||||
int i, pos;
|
int i;
|
||||||
PyObject *s, *temp, *colon = NULL;
|
PyObject *s, *temp, *colon = NULL;
|
||||||
PyObject *pieces = NULL, *result = NULL;
|
PyObject *pieces = NULL, *result = NULL;
|
||||||
PyObject *key, *value;
|
PyObject *key, *value;
|
||||||
|
@ -834,8 +834,8 @@ dict_repr(dictobject *mp)
|
||||||
|
|
||||||
/* Do repr() on each key+value pair, and insert ": " between them.
|
/* Do repr() on each key+value pair, and insert ": " between them.
|
||||||
Note that repr may mutate the dict. */
|
Note that repr may mutate the dict. */
|
||||||
pos = 0;
|
i = 0;
|
||||||
while (PyDict_Next((PyObject *)mp, &pos, &key, &value)) {
|
while (PyDict_Next((PyObject *)mp, &i, &key, &value)) {
|
||||||
int status;
|
int status;
|
||||||
/* Prevent repr from deleting value during key format. */
|
/* Prevent repr from deleting value during key format. */
|
||||||
Py_INCREF(value);
|
Py_INCREF(value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue