| 1538 | " TypeError: If the argument is not string-like or incorrect number of arguments is provided."; |
| 1539 | |
| 1540 | static PyObject *Str_like_bytesum(PyObject *self, PyObject *const *args, Py_ssize_t positional_args_count, |
| 1541 | PyObject *args_names_tuple) { |
| 1542 | // Check minimum arguments |
| 1543 | int is_member = self != NULL && PyObject_TypeCheck(self, &StrType); |
| 1544 | if (positional_args_count < !is_member || positional_args_count > !is_member + 1 || args_names_tuple) { |
| 1545 | PyErr_SetString(PyExc_TypeError, "bytesum() expects exactly one positional argument"); |
| 1546 | return NULL; |
| 1547 | } |
| 1548 | |
| 1549 | PyObject *text_obj = is_member ? self : args[0]; |
| 1550 | sz_string_view_t text; |
| 1551 | |
| 1552 | // Validate and convert `text` |
| 1553 | if (!sz_py_export_string_like(text_obj, &text.start, &text.length)) { |
| 1554 | wrap_current_exception("The text argument must be string-like"); |
| 1555 | return NULL; |
| 1556 | } |
| 1557 | |
| 1558 | sz_u64_t result = sz_bytesum(text.start, text.length); |
| 1559 | return PyLong_FromUnsignedLongLong((unsigned long long)result); |
| 1560 | } |
| 1561 | |
| 1562 | static char const doc_like_sha256[] = // |
| 1563 | "Compute SHA256 cryptographic hash of the input data.\n" |
nothing calls this directly
no test coverage detected
searching dependent graphs…