mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Issue #26020: Fix evaluation order for set literals
This commit is contained in:
parent
5dc504c3c9
commit
262b6793e0
3 changed files with 21 additions and 2 deletions
|
@ -2580,14 +2580,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
TARGET(BUILD_SET) {
|
||||
PyObject *set = PySet_New(NULL);
|
||||
int err = 0;
|
||||
int i;
|
||||
if (set == NULL)
|
||||
goto error;
|
||||
while (--oparg >= 0) {
|
||||
PyObject *item = POP();
|
||||
for (i = oparg; i > 0; i--) {
|
||||
PyObject *item = PEEK(i);
|
||||
if (err == 0)
|
||||
err = PySet_Add(set, item);
|
||||
Py_DECREF(item);
|
||||
}
|
||||
STACKADJ(-oparg);
|
||||
if (err != 0) {
|
||||
Py_DECREF(set);
|
||||
goto error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue