Skip to content

Commit badf077

Browse files
Update str_ops.c
1 parent d412153 commit badf077

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mypyc/lib-rt/str_ops.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,12 @@ PyObject *CPy_Encode(PyObject *obj, PyObject *encoding, PyObject *errors) {
511511
}
512512
}
513513

514-
Py_ssize_t CPyStr_Count(PyObject *unicode, PyObject *substring, Py_ssize_t start) {
514+
Py_ssize_t CPyStr_Count(PyObject *unicode, PyObject *substring, CPyTagged start) {
515+
Py_ssize_t temp_start = CPyTagged_AsSsize_t(start);
516+
if (temp_start == -1 && PyErr_Occurred()) {
517+
PyErr_SetString(PyExc_OverflowError, CPYTHON_LARGE_INT_ERRMSG);
518+
return NULL;
519+
}
515520
Py_ssize_t end = PyUnicode_GET_LENGTH(unicode);
516521
return PyUnicode_Count(unicode, substring, start, end);
517522
}

0 commit comments

Comments
 (0)