mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
Issue #2335: Backport set literals syntax from Python 3.x.
This commit is contained in:
parent
e365613528
commit
ee936a2130
24 changed files with 562 additions and 285 deletions
|
@ -2186,6 +2186,25 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
}
|
||||
break;
|
||||
|
||||
case BUILD_SET:
|
||||
x = PySet_New(NULL);
|
||||
if (x != NULL) {
|
||||
for (; --oparg >= 0;) {
|
||||
w = POP();
|
||||
if (err == 0)
|
||||
err = PySet_Add(x, w);
|
||||
Py_DECREF(w);
|
||||
}
|
||||
if (err != 0) {
|
||||
Py_DECREF(x);
|
||||
break;
|
||||
}
|
||||
PUSH(x);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BUILD_MAP:
|
||||
x = _PyDict_NewPresized((Py_ssize_t)oparg);
|
||||
PUSH(x);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue