summaryrefslogtreecommitdiff
path: root/Python/peephole.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-10-22 11:22:50 +0000
committerRaymond Hettinger <python@rcn.com>2009-10-22 11:22:50 +0000
commit2af1d72a116233f3774a629f4fb822a79a40db84 (patch)
tree1d05d3a971bfa8ca311c373dca4b68d218e32f30 /Python/peephole.c
parentc4873cafc6b8ba675f3a1d01513a909d1a327b89 (diff)
downloadcpython-2af1d72a116233f3774a629f4fb822a79a40db84.tar.gz
Peephole constant folding had missed UNARY_POSITIVE.
Diffstat (limited to 'Python/peephole.c')
-rw-r--r--Python/peephole.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/peephole.c b/Python/peephole.c
index 9163091272..104db8cb97 100644
--- a/Python/peephole.c
+++ b/Python/peephole.c
@@ -197,6 +197,9 @@ fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts)
case UNARY_INVERT:
newconst = PyNumber_Invert(v);
break;
+ case UNARY_POSITIVE:
+ newconst = PyNumber_Positive(v);
+ break;
default:
/* Called with an unknown opcode */
PyErr_Format(PyExc_SystemError,
@@ -500,6 +503,7 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
LOAD_CONST c1 UNARY_OP --> LOAD_CONST unary_op(c) */
case UNARY_NEGATIVE:
case UNARY_INVERT:
+ case UNARY_POSITIVE:
if (lastlc >= 1 &&
ISBASICBLOCK(blocks, i-3, 4) &&
fold_unaryops_on_constants(&codestr[i-3], consts)) {