Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 58229:c2fdf25329ff legacy-trunk
Issue #2335: Backport set literals syntax from Python 3.x.
| author | Alexandre Vassalotti <alexandre@peadrop.com> |
|---|---|
| date | Sat, 09 Jan 2010 23:35:54 +0000 |
| parents | 8f6eee42f810 |
| children | edfed0e32ced |
line wrap: on
line diff
--- a/Python/ceval.c Sat Jan 09 18:50:50 2010 +0000 +++ b/Python/ceval.c Sat Jan 09 23:35:54 2010 +0000 @@ -2186,6 +2186,25 @@ } 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);
