From: Carl Meyer Date: Tue, 9 May 2023 14:53:19 +0000 (-0600) Subject: gh-104184: fix building --with-pydebug --enable-pystats (#104217) X-Git-Tag: v3.12.0b1~195 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=afe7703744f813adb15719642444b5fd35888d86;p=thirdparty%2FPython%2Fcpython.git gh-104184: fix building --with-pydebug --enable-pystats (#104217) --- diff --git a/Python/specialize.c b/Python/specialize.c index b1cc66124cfa..2ccca3a2802c 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -1455,7 +1455,7 @@ _Py_Specialize_StoreSubscr(PyObject *container, PyObject *sub, _Py_CODEUNIT *ins goto fail; } if (PyObject_CheckBuffer(container)) { - if (PyLong_CheckExact(sub) && (((size_t)Py_SIZE(sub)) > 1)) { + if (PyLong_CheckExact(sub) && (!_PyLong_IsNonNegativeCompact((PyLongObject *)sub))) { SPECIALIZATION_FAIL(STORE_SUBSCR, SPEC_FAIL_OUT_OF_RANGE); } else if (strcmp(container_type->tp_name, "array.array") == 0) {