| 838 | PYBIND11_OBJECT_DEFAULT(dtype, object, detail::npy_api::get().PyArrayDescr_Check_) |
| 839 | |
| 840 | explicit dtype(const buffer_info &info) { |
| 841 | dtype descr(_dtype_from_pep3118()(pybind11::str(info.format))); |
| 842 | // If info.itemsize == 0, use the value calculated from the format string |
| 843 | m_ptr = descr.strip_padding(info.itemsize != 0 ? info.itemsize : descr.itemsize()) |
| 844 | .release() |
| 845 | .ptr(); |
| 846 | } |
| 847 | |
| 848 | explicit dtype(const pybind11::str &format) : dtype(from_args(format)) {} |
| 849 |