From ca65374f0e6caf8c4f2e34df8c9745103c8894d8 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Thu, 21 May 2026 01:16:51 -0700 Subject: [PATCH] fix build against protobuf v34+ Upstream protobuf changed StringViewArg from const std::string& to absl::string_view: https://github.com/protocolbuffers/protobuf/commit/aeb5f2dfac014d1e5d47bbd5dcfbf824cc8c5a24 By using the same StringViewArg alias they use in their declarations, we can fix the build against protobuf v34+ without losing support for older versions. We get new warnings, because this alias is deprecated, but I think that's better than bumping the required protobuf version unnecessarily. This approach can always be revisited if they fully drop StringViewArg in the future. Tested against protobuf v32.1 and v34.1. --- pybind11_protobuf/proto_cast_util.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pybind11_protobuf/proto_cast_util.cc b/pybind11_protobuf/proto_cast_util.cc index 5f5d422..006ddca 100644 --- a/pybind11_protobuf/proto_cast_util.cc +++ b/pybind11_protobuf/proto_cast_util.cc @@ -361,7 +361,7 @@ class PythonDescriptorPoolWrapper { // Find a file by file name. bool FindFileByName( - const std::string& filename + StringViewArg filename , FileDescriptorProto* output) override { try { @@ -379,7 +379,7 @@ class PythonDescriptorPoolWrapper { // Find the file that declares the given fully-qualified symbol name. bool FindFileContainingSymbol( - const std::string& symbol_name + StringViewArg symbol_name , FileDescriptorProto* output) override { try { @@ -399,7 +399,7 @@ class PythonDescriptorPoolWrapper { // Find the file which defines an extension extending the given message type // with the given field number. bool FindFileContainingExtension( - const std::string& containing_type + StringViewArg containing_type , int field_number, FileDescriptorProto* output) override { try {