Skip to content

Commit

Permalink
Prepare code for breaking change in Protobuf C++ API.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pybind11_protobuf authors authored and copybara-github committed Jan 14, 2025
1 parent 90b1a5b commit 324672e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pybind11_protobuf/proto_cast_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ namespace {
// Resolves the class name of a descriptor via d->containing_type()
py::object ResolveDescriptor(py::object p, const Descriptor* d) {
return d->containing_type() ? ResolveDescriptor(p, d->containing_type())
.attr(py::str(d->name()))
: p.attr(py::str(d->name()));
.attr(py::str(std::string_view(d->name())))
: p.attr(py::str(std::string_view(d->name())));
}

// Returns true if an exception is an import error.
Expand Down

0 comments on commit 324672e

Please sign in to comment.