diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-09 23:35:54 +0000 |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2010-01-09 23:35:54 +0000 |
commit | ee936a21308679654b2d458166ff094ed735fef7 (patch) | |
tree | 612cd109e8ede4080f58f30ece3212d8e0f996d2 /Python/ceval.c | |
parent | e36561352895170f28f77f0b4ec4292e35d1cc01 (diff) | |
download | cpython-git-ee936a21308679654b2d458166ff094ed735fef7.tar.gz |
Issue #2335: Backport set literals syntax from Python 3.x.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index e5e70463f7..3221ab1097 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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); |