Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 46162:ca38f7a4b4c9 legacy-trunk
Patch #1810 by Thomas Lee, reviewed by myself:
allow compiling Python AST objects into code objects
in compile().
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Fri, 28 Mar 2008 12:11:56 +0000 |
| parents | 4e358ed7f515 |
| children | 3b994f74b100 |
line wrap: on
line diff
--- a/Python/compile.c Fri Mar 28 08:32:09 2008 +0000 +++ b/Python/compile.c Fri Mar 28 12:11:56 2008 +0000 @@ -2211,8 +2211,11 @@ 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 @@ 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 @@ return PyCmp_IN; case NotIn: return PyCmp_NOT_IN; + default: + return PyCmp_BAD; } - return PyCmp_BAD; } static int @@ -2309,10 +2316,11 @@ 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
