diff --git a/Objects/intobject.c b/Objects/intobject.c index 728f798a5b6..40f38ba343b 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -675,13 +675,15 @@ int_lshift(PyIntObject *v, PyIntObject *w) return NULL; return PyInt_FromLong(0L); } - c = (long)((unsigned long)a << b); - if ((c >> b) != a || (c < 0 && a > 0)) { + c = a < 0 ? ~a : a; + c >>= LONG_BIT - 1 - b; + if (c) { if (PyErr_Warn(PyExc_DeprecationWarning, "x<