Skip to content

Commit 4a9f006

Browse files
WIP: new mypyc primitives for str.count
1 parent fe91422 commit 4a9f006

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mypyc/lib-rt/str_ops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@ PyObject *CPy_Encode(PyObject *obj, PyObject *encoding, PyObject *errors) {
511511
}
512512
}
513513

514+
Py_ssize_t CPyStr_CountAll(PyObject *unicode, PyObject *substring) {
515+
Py_ssize_t end = PyUnicode_GET_LENGTH(self);
516+
return PyUnicode_Count(unicode, substring, 0, end);
517+
514518

515519
CPyTagged CPyStr_Ord(PyObject *obj) {
516520
Py_ssize_t s = PyUnicode_GET_LENGTH(obj);

0 commit comments

Comments
 (0)