]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104184: fix building --with-pydebug --enable-pystats (#104217)
authorCarl Meyer <carl@oddbird.net>
Tue, 9 May 2023 14:53:19 +0000 (08:53 -0600)
committerGitHub <noreply@github.com>
Tue, 9 May 2023 14:53:19 +0000 (08:53 -0600)
Python/specialize.c

index b1cc66124cfa4aecad5083826b3a5f678331ba7d..2ccca3a2802c173ead31ece5b3c98e3e4579a646 100644 (file)
@@ -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) {