Skip to content

Commit 016f754

Browse files
BlaziusMaximuscopybara-github
authored andcommitted
Use pybind11_protobuf when passing Fingerprints.
PiperOrigin-RevId: 556081074
1 parent b2e7687 commit 016f754

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pybind11_protobuf/proto_caster_impl.h

+8
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,24 @@ struct proto_caster_load_impl {
4040

4141
// load converts from Python -> C++
4242
bool load(pybind11::handle src, bool convert) {
43+
LOG(ERROR) << 1;
4344
// When given a none, treat it as a nullptr.
4445
if (src.is_none()) {
4546
value = nullptr;
4647
return true;
4748
}
49+
LOG(ERROR) << 1;
4850
// NOTE: We might need to know whether the proto has extensions that
4951
// are python-only.
5052

5153
// Attempt to use the PyProto_API to get an underlying C++ message pointer
5254
// from the object.
5355
const ::google::protobuf::Message *message =
5456
pybind11_protobuf::PyProtoGetCppMessagePointer(src);
57+
LOG(ERROR) << 1;
5558
if (message && message->GetReflection() ==
5659
ProtoType::default_instance().GetReflection()) {
60+
LOG(ERROR) << 1;
5761
// If the capability were available, then we could probe PyProto_API and
5862
// allow c++ mutability based on the python reference count.
5963
value = static_cast<const ProtoType *>(message);
@@ -62,13 +66,17 @@ struct proto_caster_load_impl {
6266

6367
// The incoming object is not a compatible fast_cpp_proto, so check whether
6468
// it is otherwise compatible, then serialize it and deserialize into a
69+
LOG(ERROR) << 1;
6570
// native C++ proto type.
6671
if (!pybind11_protobuf::PyProtoIsCompatible(src,
6772
ProtoType::GetDescriptor())) {
73+
LOG(ERROR) << 1;
6874
return false;
6975
}
76+
LOG(ERROR) << 1;
7077
owned = std::unique_ptr<ProtoType>(new ProtoType());
7178
value = owned.get();
79+
LOG(ERROR) << 1;
7280
return pybind11_protobuf::PyProtoCopyToCProto(src, owned.get());
7381
}
7482

0 commit comments

Comments
 (0)