diff --git a/Objects/object.c b/Objects/object.c index 6a22f27de0b1c8..c4f2786c50a02b 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -1076,8 +1076,9 @@ _PyObject_DictPointer(PyObject *obj) tsize = -tsize; } size_t size = _PyObject_VAR_SIZE(tp, tsize); + assert(size <= (size_t)PY_SSIZE_T_MAX); + dictoffset += (Py_ssize_t)size; - dictoffset += (long)size; _PyObject_ASSERT(obj, dictoffset > 0); _PyObject_ASSERT(obj, dictoffset % SIZEOF_VOID_P == 0); }