Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 19613:f7cf8961c667 legacy-trunk
When re-writing a factor containing a unary negation of a literal, only
affect nodes without another operator. This was causing negated
exponentiations to drop the exponentiation. This closes SF bug #456756.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Thu, 30 Aug 2001 18:53:25 +0000 |
| parents | 04fd3869c6bb |
| children | e2e9f1722c4f |
line wrap: on
line diff
--- a/Python/compile.c Thu Aug 30 18:31:30 2001 +0000 +++ b/Python/compile.c Thu Aug 30 18:53:25 2001 +0000 @@ -1891,8 +1891,11 @@ negative in the 0th position. */ if ((childtype == PLUS || childtype == MINUS || childtype == TILDE) + && NCH(n) == 2 && TYPE(CHILD(n, 1)) == factor + && NCH(CHILD(n, 1)) == 1 && TYPE(CHILD(CHILD(n, 1), 0)) == power + && NCH(CHILD(CHILD(n, 1), 0)) == 1 && TYPE(CHILD(CHILD(CHILD(n, 1), 0), 0)) == atom && TYPE(CHILD(CHILD(CHILD(CHILD(n, 1), 0), 0), 0)) == NUMBER) { node *constant = CHILD(CHILD(CHILD(n, 1), 0), 0);
