summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-04-09 21:39:57 (GMT)
committerGuido van Rossum <guido@python.org>1998-04-09 21:39:57 (GMT)
commitd295f120ae6bd624eaac9032b70fad0aec110597 (patch)
treeb35a80e21cc3bceff0cc766d15582cf30c02225f /Python/compile.c
parent926f13a0819eb3d40a0d0fd38ff25ef0c7d489b3 (diff)
downloadcpython-d295f120ae6bd624eaac9032b70fad0aec110597.zip
cpython-d295f120ae6bd624eaac9032b70fad0aec110597.tar.gz
cpython-d295f120ae6bd624eaac9032b70fad0aec110597.tar.bz2
Make first raise argument optional
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Python/compile.c b/Python/compile.c
index b4658e4..312600d 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -659,6 +659,8 @@ com_add(c, list, v)
{
int n = PyList_Size(list);
int i;
+ /* XXX This is quadratic in the number of names per compilation unit.
+ XXX Should use a dictionary. */
for (i = n; --i >= 0; ) {
PyObject *w = PyList_GetItem(list, i);
if (v->ob_type == w->ob_type && PyObject_Compare(v, w) == 0)
@@ -2050,12 +2052,14 @@ com_raise_stmt(c, n)
node *n;
{
int i;
- REQ(n, raise_stmt); /* 'raise' test [',' test [',' test]] */
- com_node(c, CHILD(n, 1));
- if (NCH(n) > 3) {
- com_node(c, CHILD(n, 3));
- if (NCH(n) > 5)
- com_node(c, CHILD(n, 5));
+ REQ(n, raise_stmt); /* 'raise' [test [',' test [',' test]]] */
+ if (NCH(n) > 1) {
+ com_node(c, CHILD(n, 1));
+ if (NCH(n) > 3) {
+ com_node(c, CHILD(n, 3));
+ if (NCH(n) > 5)
+ com_node(c, CHILD(n, 5));
+ }
}
i = NCH(n)/2;
com_addoparg(c, RAISE_VARARGS, i);