mirror of https://github.com/python/cpython
Issue #27214: Fix potential bug and remove useless optimization in long_invert. Thanks Oren Milman.
This commit is contained in:
parent
2be278c70c
commit
583c6e860c
|
@ -10,6 +10,10 @@ What's New in Python 3.6.0 beta 1
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #27214: In long_invert, be more careful about modifying object
|
||||||
|
returned by long_add, and remove an unnecessary check for small longs.
|
||||||
|
Thanks Oren Milman for analysis and patch.
|
||||||
|
|
||||||
- Issue #27506: Support passing the bytes/bytearray.translate() "delete"
|
- Issue #27506: Support passing the bytes/bytearray.translate() "delete"
|
||||||
argument by keyword.
|
argument by keyword.
|
||||||
|
|
||||||
|
|
|
@ -4170,8 +4170,10 @@ long_invert(PyLongObject *v)
|
||||||
Py_DECREF(w);
|
Py_DECREF(w);
|
||||||
if (x == NULL)
|
if (x == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_SIZE(x) = -(Py_SIZE(x));
|
_PyLong_Negate(&x);
|
||||||
return (PyObject *)maybe_small_long(x);
|
/* No need for maybe_small_long here, since any small
|
||||||
|
longs will have been caught in the Py_SIZE <= 1 fast path. */
|
||||||
|
return (PyObject *)x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
Loading…
Reference in New Issue