File tree 1 file changed +2
-0
lines changed 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -1090,6 +1090,7 @@ class str : public object {
1090
1090
str (std::string_view s) : str(s.data(), s.size()) { }
1091
1091
1092
1092
# ifdef PYBIND11_HAS_U8STRING
1093
+ // reinterpret_cast here is safe (C++20 guarantees char8_t has the same size/alignment as char)
1093
1094
// NOLINTNEXTLINE(google-explicit-constructor)
1094
1095
str (std::u8string_view s) : str(reinterpret_cast <const char *>(s.data()), s.size()) { }
1095
1096
# endif
@@ -1186,6 +1187,7 @@ class bytes : public object {
1186
1187
// Obtain a string view that views the current `bytes` buffer value. Note that this is only
1187
1188
// valid so long as the `bytes` instance remains alive and so generally should not outlive the
1188
1189
// lifetime of the `bytes` instance.
1190
+ // NOLINTNEXTLINE(google-explicit-constructor)
1189
1191
operator std::string_view () const {
1190
1192
char *buffer = nullptr ;
1191
1193
ssize_t length = 0 ;
You can’t perform that action at this time.
0 commit comments