Extract the bytes data.
| 10 | |
| 11 | // Extract the bytes data. |
| 12 | static std::string to_string(Py_buffer& value) { |
| 13 | auto buffer = (char*)malloc(value.len + 1); |
| 14 | PyBuffer_ToContiguous(buffer, &value, value.len, 'C'); |
| 15 | PyBuffer_Release(&value); |
| 16 | auto s = std::string(buffer, value.len); |
| 17 | free(buffer); |
| 18 | return s; |
| 19 | } |
| 20 | |
| 21 | // Create PyString from underlying char array |
| 22 | static PyObject* from_string(std::string& value) { |
nothing calls this directly
no outgoing calls
no test coverage detected