diff options
author | Raymond Hettinger <python@rcn.com> | 2016-09-08 15:25:19 -0700 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-09-08 15:25:19 -0700 |
commit | e62a694fee53ba7fc16d6afbaa53b373c878f300 (patch) | |
tree | 08464fc231f3efbe4328ab147ea9313df73cbfc5 /Python | |
parent | cb20a2174053148ba22d4d50a86bcef430c1b66f (diff) | |
download | cpython-git-e62a694fee53ba7fc16d6afbaa53b373c878f300.tar.gz |
Issue #26020: Fix evaluation order for set literals
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 0b747d8281..2af78ff874 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2477,14 +2477,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) TARGET(BUILD_SET) { + int i; x = PySet_New(NULL); if (x != NULL) { - for (; --oparg >= 0;) { - w = POP(); + for (i = oparg; i > 0; i--) { + w = PEEK(i); if (err == 0) err = PySet_Add(x, w); Py_DECREF(w); } + STACKADJ(-oparg); if (err != 0) { Py_DECREF(x); break; |