* @brief Will be called by the `PySequence_Contains` to check presence of a substring. * @return 1 if the string is present, 0 if it is not, -1 in case of error. * @see Docs: https://docs.python.org/3/c-api/sequence.html#c.PySequence_Contains */
| 1840 | * @see Docs: https://docs.python.org/3/c-api/sequence.html#c.PySequence_Contains |
| 1841 | */ |
| 1842 | static int Str_in(Str *self, PyObject *needle_obj) { |
| 1843 | |
| 1844 | sz_string_view_t needle; |
| 1845 | if (!sz_py_export_string_like(needle_obj, &needle.start, &needle.length)) { |
| 1846 | wrap_current_exception("Unsupported needle layout"); |
| 1847 | return -1; |
| 1848 | } |
| 1849 | |
| 1850 | return sz_find(self->memory.start, self->memory.length, needle.start, needle.length) != NULL; |
| 1851 | } |
| 1852 | |
| 1853 | /** |
| 1854 | * @brief Ensures the Strs is in a tape layout (not fragmented). |
nothing calls this directly
no test coverage detected
searching dependent graphs…