MCPcopy Create free account
hub / github.com/ceph/ceph / py_bytes_as_span

Function py_bytes_as_span

src/mgr/PyModule.cc:160–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160std::span<std::byte const> py_bytes_as_span(PyObject *bytes)
161{
162 assert(bytes);
163 assert(PyBytes_CheckExact(bytes));
164 Py_ssize_t length;
165 char *buf;
166 int r = PyBytes_AsStringAndSize(
167 bytes, &buf, &length);
168 assert(r == 0);
169 return std::span<std::byte const>((const std::byte*)buf, size_t(length));
170}
171
172PyObject *py_bytes_from_span(std::span<std::byte const> s)
173{

Callers 1

ceph_dispatch_remoteFunction · 0.85

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected