* Convert functions helper for the generic converter. */
| 339 | * Convert functions helper for the generic converter. |
| 340 | */ |
| 341 | static PyObject * |
| 342 | call_converter_function( |
| 343 | PyObject *func, const Py_UCS4 *str, size_t length, bool byte_converters) |
| 344 | { |
| 345 | PyObject *s = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, str, length); |
| 346 | if (s == NULL) { |
| 347 | return s; |
| 348 | } |
| 349 | if (byte_converters) { |
| 350 | Py_SETREF(s, PyUnicode_AsEncodedString(s, "latin1", NULL)); |
| 351 | if (s == NULL) { |
| 352 | return NULL; |
| 353 | } |
| 354 | } |
| 355 | if (func == NULL) { |
| 356 | return s; |
| 357 | } |
| 358 | PyObject *result = PyObject_CallFunctionObjArgs(func, s, NULL); |
| 359 | Py_DECREF(s); |
| 360 | return result; |
| 361 | } |
| 362 | |
| 363 | |
| 364 | NPY_NO_EXPORT int |
no outgoing calls
no test coverage detected