| 1597 | |
| 1598 | template <typename SzType, detail::enable_if_t<std::is_integral<SzType>::value, int> = 0> |
| 1599 | str(const char *c, const SzType &n) |
| 1600 | : object(PyUnicode_FromStringAndSize(c, ssize_t_cast(n)), stolen_t{}) { |
| 1601 | if (!m_ptr) { |
| 1602 | if (PyErr_Occurred()) { |
| 1603 | throw error_already_set(); |
| 1604 | } |
| 1605 | pybind11_fail("Could not allocate string object!"); |
| 1606 | } |
| 1607 | } |
| 1608 | |
| 1609 | // 'explicit' is explicitly omitted from the following constructors to allow implicit |
| 1610 | // conversion to py::str from C++ string-like objects |
nothing calls this directly
no test coverage detected