MCPcopy Create free account
hub / github.com/pybind/pybind11 / print_bytes

Function print_bytes

tests/test_constants_and_functions.cpp:31–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31std::string print_bytes(const py::bytes &bytes) {
32 std::string ret = "bytes[";
33 const auto value = static_cast<std::string>(bytes);
34 for (char c : value) {
35 ret += std::to_string(static_cast<int>(c)) + ' ';
36 }
37 ret.back() = ']';
38 return ret;
39}
40
41// Test that we properly handle C++17 exception specifiers (which are part of the function
42// signature in C++17). These should all still work before C++17, but don't affect the function

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected