diff options
author | Raymond Hettinger <python@rcn.com> | 2009-10-22 11:22:50 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-10-22 11:22:50 (GMT) |
commit | af7adad51d149e66ee3eb66c1765914f0fd7f905 (patch) | |
tree | bad46171fbca07a72f698e7a63e312fd952a5fd6 /Python/peephole.c | |
parent | 42ead48dc17543c0d41d261fdf070a07f576c449 (diff) | |
download | cpython-af7adad51d149e66ee3eb66c1765914f0fd7f905.zip cpython-af7adad51d149e66ee3eb66c1765914f0fd7f905.tar.gz cpython-af7adad51d149e66ee3eb66c1765914f0fd7f905.tar.bz2 |
Peephole constant folding had missed UNARY_POSITIVE.
Diffstat (limited to 'Python/peephole.c')
-rw-r--r-- | Python/peephole.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/peephole.c b/Python/peephole.c index 9163091..104db8c 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)) { |