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

Method str

include/pybind11/pytypes.h:1647–1655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1645
1646 template <typename SzType, detail::enable_if_t<std::is_integral<SzType>::value, int> = 0>
1647 str(const char *c, const SzType &n)
1648 : object(PyUnicode_FromStringAndSize(c, ssize_t_cast(n)), stolen_t{}) {
1649 if (!m_ptr) {
1650 if (PyErr_Occurred()) {
1651 throw error_already_set();
1652 }
1653 pybind11_fail("Could not allocate string object!");
1654 }
1655 }
1656
1657 // 'explicit' is explicitly omitted from the following constructors to allow implicit
1658 // conversion to py::str from C++ string-like objects

Callers

nothing calls this directly

Calls 5

ssize_t_castFunction · 0.85
ptrMethod · 0.80
handleFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected