mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
4b8c0f6d7d
commit
14ef244dfe
1 changed files with 3 additions and 0 deletions
|
@ -1891,8 +1891,11 @@ com_factor(struct compiling *c, node *n)
|
||||||
negative in the 0th position.
|
negative in the 0th position.
|
||||||
*/
|
*/
|
||||||
if ((childtype == PLUS || childtype == MINUS || childtype == TILDE)
|
if ((childtype == PLUS || childtype == MINUS || childtype == TILDE)
|
||||||
|
&& NCH(n) == 2
|
||||||
&& TYPE(CHILD(n, 1)) == factor
|
&& TYPE(CHILD(n, 1)) == factor
|
||||||
|
&& NCH(CHILD(n, 1)) == 1
|
||||||
&& TYPE(CHILD(CHILD(n, 1), 0)) == power
|
&& 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(n, 1), 0), 0)) == atom
|
||||||
&& TYPE(CHILD(CHILD(CHILD(CHILD(n, 1), 0), 0), 0)) == NUMBER) {
|
&& TYPE(CHILD(CHILD(CHILD(CHILD(n, 1), 0), 0), 0)) == NUMBER) {
|
||||||
node *constant = CHILD(CHILD(CHILD(n, 1), 0), 0);
|
node *constant = CHILD(CHILD(CHILD(n, 1), 0), 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue