python/dist/src/Python compile.c,2.346,2.347
Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25613 Modified Files: compile.c Log Message: Preserve sign of -0.0 when result is run through marshal. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.346 retrieving revision 2.347 diff -u -d -r2.346 -r2.347 --- compile.c 21 Feb 2005 20:03:14 -0000 2.346 +++ compile.c 23 Feb 2005 13:37:55 -0000 2.347 @@ -545,7 +545,7 @@ static int fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts) { - PyObject *newconst, *v; + PyObject *newconst=NULL, *v; int len_consts, opcode; /* Pre-conditions */ @@ -557,7 +557,9 @@ opcode = codestr[3]; switch (opcode) { case UNARY_NEGATIVE: - newconst = PyNumber_Negative(v); + /* Preserve the sign of -0.0 */ + if (PyObject_IsTrue(v) == 1) + newconst = PyNumber_Negative(v); break; case UNARY_CONVERT: newconst = PyObject_Repr(v);
participants (1)
-
rhettingerīŧ users.sourceforge.net