1111#include < string>
1212#include < unordered_set>
1313#include < utility>
14- #include < vector>
1514
16- #include " google/protobuf/descriptor.pb.h"
1715#include " absl/container/flat_hash_map.h"
1816#include " absl/log/check.h"
1917#include " absl/log/log.h"
2523#include " absl/strings/strip.h"
2624#include " absl/types/optional.h"
2725#include " google/protobuf/descriptor.h"
26+ #include " google/protobuf/descriptor.pb.h"
2827#include " google/protobuf/descriptor_database.h"
2928#include " google/protobuf/dynamic_message.h"
3029
@@ -34,7 +33,6 @@ using ::google::protobuf::Descriptor;
3433using ::google::protobuf::DescriptorDatabase;
3534using ::google::protobuf::DescriptorPool;
3635using ::google::protobuf::DynamicMessageFactory;
37- using ::google::protobuf::FileDescriptor;
3836using ::google::protobuf::FileDescriptorProto;
3937using ::google::protobuf::Message;
4038using ::google::protobuf::MessageFactory;
@@ -184,10 +182,8 @@ GlobalState::GlobalState() {
184182 // pybind11_protobuf casting needs a dependency on proto internals to work.
185183 try {
186184 ImportCached (" google.protobuf.descriptor" );
187- auto descriptor_pool =
188- ImportCached (" google.protobuf.descriptor_pool" );
189- auto message_factory =
190- ImportCached (" google.protobuf.message_factory" );
185+ auto descriptor_pool = ImportCached (" google.protobuf.descriptor_pool" );
186+ auto message_factory = ImportCached (" google.protobuf.message_factory" );
191187 global_pool_ = descriptor_pool.attr (" Default" )();
192188 find_message_type_by_name_ = global_pool_.attr (" FindMessageTypeByName" );
193189 if (hasattr (message_factory, " GetMessageClass" )) {
@@ -221,6 +217,7 @@ py::module_ GlobalState::ImportCached(const std::string& module_name) {
221217 if (cached != import_cache_.end ()) {
222218 return cached->second ;
223219 }
220+ LOG (INFO) << " ImportCached " << module_name;
224221 auto module = py::module_::import (module_name.c_str ());
225222 import_cache_[module_name] = module ;
226223 return module ;
0 commit comments