summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-28 12:11:56 (GMT)
committerGeorg Brandl <georg@python.org>2008-03-28 12:11:56 (GMT)
commitfc8eef3c78200593c9c70974e48ab859779c607a (patch)
tree6c1cddba98dad1770c0f22a08d88455d7dc7eeaa /Python/compile.c
parentb9803421d231fc66489eafb45f6ae440010cacfc (diff)
downloadcpython-fc8eef3c78200593c9c70974e48ab859779c607a.zip
cpython-fc8eef3c78200593c9c70974e48ab859779c607a.tar.gz
cpython-fc8eef3c78200593c9c70974e48ab859779c607a.tar.bz2
Patch #1810 by Thomas Lee, reviewed by myself:
allow compiling Python AST objects into code objects in compile().
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 47a63e7..4f55b36 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2211,8 +2211,11 @@ unaryop(unaryop_ty op)
return UNARY_POSITIVE;
case USub:
return UNARY_NEGATIVE;
+ default:
+ PyErr_Format(PyExc_SystemError,
+ "unary op %d should not be possible", op);
+ return 0;
}
- return 0;
}
static int
@@ -2246,8 +2249,11 @@ binop(struct compiler *c, operator_ty op)
return BINARY_AND;
case FloorDiv:
return BINARY_FLOOR_DIVIDE;
+ default:
+ PyErr_Format(PyExc_SystemError,
+ "binary op %d should not be possible", op);
+ return 0;
}
- return 0;
}
static int
@@ -2274,8 +2280,9 @@ cmpop(cmpop_ty op)
return PyCmp_IN;
case NotIn:
return PyCmp_NOT_IN;
+ default:
+ return PyCmp_BAD;
}
- return PyCmp_BAD;
}
static int
@@ -2309,10 +2316,11 @@ inplace_binop(struct compiler *c, operator_ty op)
return INPLACE_AND;
case FloorDiv:
return INPLACE_FLOOR_DIVIDE;
+ default:
+ PyErr_Format(PyExc_SystemError,
+ "inplace binary op %d should not be possible", op);
+ return 0;
}
- PyErr_Format(PyExc_SystemError,
- "inplace binary op %d should not be possible", op);
- return 0;
}
static int