mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #11244: Remove outdated peepholer check that was preventing the peepholer from folding -0 and -0.0. Thanks Eugene Toder for the patch.
This commit is contained in:
parent
ba7b560c1d
commit
7c9e803284
4 changed files with 17 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue