Kaydet (Commit) e63a0786 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Preserve sign of -0.0 when result is run through marshal.

üst 71dcc3e9
......@@ -545,7 +545,7 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
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 @@ fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts)
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment