summaryrefslogtreecommitdiff
path: root/Python/peephole.c
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2011-03-23 17:59:37 +0000
committerMark Dickinson <mdickinson@enthought.com>2011-03-23 17:59:37 +0000
commit07853354ede24bc0033485b335e0859b8212a429 (patch)
tree4c5f92a7078abf90680e9622e060003d67d503c1 /Python/peephole.c
parente085071f0cccbcdaeaed3d3ba0ecabd88b917a69 (diff)
downloadcpython-07853354ede24bc0033485b335e0859b8212a429.tar.gz
Issue #11244: Remove outdated peepholer check that was preventing the peepholer from folding -0 and -0.0. Thanks Eugene Toder for the patch.
Diffstat (limited to 'Python/peephole.c')
-rw-r--r--Python/peephole.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/peephole.c b/Python/peephole.c
index 4bc65dcc31..69f61617f8 100644
--- a/Python/peephole.c
+++ b/Python/peephole.c
@@ -238,7 +238,7 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts, PyObject **ob
static int
fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts, PyObject *v)
{
- PyObject *newconst=NULL/*, *v*/;
+ PyObject *newconst;
Py_ssize_t len_consts;
int opcode;
@@ -250,9 +250,7 @@ fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts, PyObject *v
opcode = codestr[3];
switch (opcode) {
case UNARY_NEGATIVE:
- /* Preserve the sign of -0.0 */
- if (PyObject_IsTrue(v) == 1)
- newconst = PyNumber_Negative(v);
+ newconst = PyNumber_Negative(v);
break;
case UNARY_INVERT:
newconst = PyNumber_Invert(v);