[Python-checkins] gh-104184: fix building --with-pydebug --enable-pystats (#104217)

carljm webhook-mailer at python.org
Tue May 9 10:53:28 EDT 2023


https://github.com/python/cpython/commit/afe7703744f813adb15719642444b5fd35888d86
commit: afe7703744f813adb15719642444b5fd35888d86
branch: main
author: Carl Meyer <carl at oddbird.net>
committer: carljm <carl at oddbird.net>
date: 2023-05-09T08:53:19-06:00
summary:

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

files:
M Python/specialize.c

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



More information about the Python-checkins mailing list