Skip to content

Commit 324672e

Browse files
pybind11_protobuf authorscopybara-github
authored andcommitted
Prepare code for breaking change in Protobuf C++ API.
Protobuf 6.30.0 will change the return types of Descriptor::name() and other methods to absl::string_view. This makes the code work both before and after such a change. PiperOrigin-RevId: 715199813
1 parent 90b1a5b commit 324672e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pybind11_protobuf/proto_cast_util.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ namespace {
5959
// Resolves the class name of a descriptor via d->containing_type()
6060
py::object ResolveDescriptor(py::object p, const Descriptor* d) {
6161
return d->containing_type() ? ResolveDescriptor(p, d->containing_type())
62-
.attr(py::str(d->name()))
63-
: p.attr(py::str(d->name()));
62+
.attr(py::str(std::string_view(d->name())))
63+
: p.attr(py::str(std::string_view(d->name())));
6464
}
6565

6666
// Returns true if an exception is an import error.

0 commit comments

Comments
 (0)