Issue #18427: str.replace could crash the interpreter with huge strings.

This fixes two places where 'int'  was used to represent
the size of strings, instead of 'Py_ssize_t'.

(The issue is not present in the corresponding code in the 3.x branches)

Fixes #18427
2 files changed