gh-104184: fix building --with-pydebug --enable-pystats (#104217)

This commit is contained in:
Carl Meyer 2023-05-09 08:53:19 -06:00 committed by GitHub
parent 82f789be3b
commit afe7703744
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View 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) {