in src/py_serde.cpp [60:72]
size_t py_object_serde::serialize(void* ptr, size_t capacity, const nb::object* items, unsigned num) const {
size_t bytes_written = 0;
nb::gil_scoped_acquire acquire;
for (unsigned i = 0; i < num; ++i) {
nb::bytes bytes = to_bytes(items[i]); // implicit cast from nb::bytes
check_memory_size(bytes_written + bytes.size(), capacity);
memcpy(ptr, bytes.c_str(), bytes.size());
ptr = static_cast<char*>(ptr) + bytes.size();
bytes_written += bytes.size();
}
nb::gil_scoped_release release;
return bytes_written;
}