◐ Shell
clean mode source ↗

Message 103766 - Python tracker

> I don't know if "nallocated += repsize - 4;" can overflow or not.
> If yes, how can I detect the overflow?

Sure, if they are both Py_ssize_t, just use:

if (nallocated > PY_SSIZE_T_MAX - repsize + 4) {
  /* handle overflow ... */
}