@@ -540,18 +540,16 @@ class dtype : public object {
540
540
PYBIND11_OBJECT_DEFAULT (dtype, object, detail::npy_api::get ().PyArrayDescr_Check_ );
541
541
542
542
explicit dtype (const buffer_info &info) {
543
- dtype descr (_dtype_from_pep3118 ()(PYBIND11_STR_TYPE (info.format )));
543
+ dtype descr (_dtype_from_pep3118 ()(pybind11::str (info.format )));
544
544
// If info.itemsize == 0, use the value calculated from the format string
545
545
m_ptr = descr.strip_padding (info.itemsize != 0 ? info.itemsize : descr.itemsize ())
546
546
.release ()
547
547
.ptr ();
548
548
}
549
549
550
- explicit dtype (const std::string &format) {
551
- m_ptr = from_args (pybind11::str (format)).release ().ptr ();
552
- }
550
+ explicit dtype (const std::string &format) : dtype (from_args (pybind11::str (format))) {}
553
551
554
- explicit dtype (const char *format) : dtype (std::string (format)) {}
552
+ explicit dtype (const char *format) : dtype (from_args ( pybind11::str (format) )) {}
555
553
556
554
dtype (list names, list formats, list offsets, ssize_t itemsize) {
557
555
dict args;
@@ -638,7 +636,7 @@ class dtype : public object {
638
636
}
639
637
640
638
struct field_descr {
641
- PYBIND11_STR_TYPE name;
639
+ pybind11::str name;
642
640
object format;
643
641
pybind11::int_ offset;
644
642
};
@@ -653,7 +651,7 @@ class dtype : public object {
653
651
continue ;
654
652
}
655
653
field_descriptors.push_back (
656
- {(PYBIND11_STR_TYPE ) name, format.strip_padding (format.itemsize ()), offset});
654
+ {(pybind11::str ) name, format.strip_padding (format.itemsize ()), offset});
657
655
}
658
656
659
657
std::sort (field_descriptors.begin (),
@@ -1359,7 +1357,7 @@ PYBIND11_NOINLINE void register_structured_dtype(any_container<field_descriptor>
1359
1357
pybind11_fail (std::string (" NumPy: unsupported field dtype: `" ) + field.name + " ` @ "
1360
1358
+ tinfo.name ());
1361
1359
}
1362
- names.append (PYBIND11_STR_TYPE (field.name ));
1360
+ names.append (pybind11::str (field.name ));
1363
1361
formats.append (field.descr );
1364
1362
offsets.append (pybind11::int_ (field.offset ));
1365
1363
}
0 commit comments