bpo-34397: Remove redundant overflow checks in list and tuple implementation. (GH-8757)
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index c0b59c0..1453463 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -486,8 +486,7 @@
Py_INCREF(a);
return (PyObject *)a;
}
- if (Py_SIZE(a) > PY_SSIZE_T_MAX - Py_SIZE(b))
- return PyErr_NoMemory();
+ assert((size_t)Py_SIZE(a) + (size_t)Py_SIZE(b) < PY_SSIZE_T_MAX);
size = Py_SIZE(a) + Py_SIZE(b);
if (size == 0) {
return PyTuple_New(0);