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

Function py_bytes_as_vec

src/mgr/PyModule.cc:180–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180std::vector<std::byte> py_bytes_as_vec(PyObject *bytes)
181{
182 assert(bytes);
183 assert(PyBytes_CheckExact(bytes));
184 Py_ssize_t length;
185 char *buf;
186 int r = PyBytes_AsStringAndSize(
187 bytes, &buf, &length);
188 assert(r == 0);
189 return std::vector<std::byte>{
190 reinterpret_cast<const std::byte*>(buf),
191 reinterpret_cast<const std::byte*>(buf) + size_t(length)};
192}
193
194PyObject *py_bytes_from_vec(const std::vector<std::byte> &s)
195{

Callers 1

dispatch_remoteMethod · 0.85

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected