Skip to content

Commit 7b730ad

Browse files
committed
simplify pybind11_protobuf patch and bump git version
1 parent b56eb77 commit 7b730ad

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed

Diff for: WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ new_git_repository(
248248
name = "pybind11_protobuf",
249249
#build_file = "@pybind11_bazel//:pybind11.BUILD",
250250
#tag = "v2.10.3",
251-
commit = "5baa2dc9d93e3b608cde86dfa4b8c63aeab4ac78",
251+
commit = "8359a091a9b0bc7deb0233de986c06c885a3ff2d",
252252
remote = "https://github.com/pybind/pybind11_protobuf.git",
253253
)
254254

Diff for: patches/pybind11_protobuf.patch

+7-33
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ index e936f66..eaac571 100644
55
@@ -21,7 +21,7 @@ option(BUILD_TESTS "Build tests." OFF)
66
# ============================================================================
77
# Find Python
8-
8+
99
-find_package(Python COMPONENTS Interpreter Development)
1010
+find_package(Python3 COMPONENTS Interpreter Development.Module)
11-
11+
1212
# ============================================================================
1313
# Build dependencies
1414
@@ -47,8 +47,10 @@ pybind11_add_module(
1515
pybind11_protobuf/proto_utils.h)
16-
16+
1717
target_link_libraries(
1818
- pybind11_proto_utils PRIVATE absl::strings protobuf::libprotobuf
1919
- ${Python_LIBRARIES})
2020
+ pybind11_proto_utils PRIVATE
2121
+ absl::strings
2222
+ protobuf::libprotobuf
2323
+ Python3::Module)
24-
24+
2525
target_include_directories(
2626
pybind11_proto_utils PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS}
2727
@@ -57,7 +59,7 @@ target_include_directories(
@@ -39,46 +39,20 @@ index e936f66..eaac571 100644
3939
pybind11::pybind11
4040
- ${Python_LIBRARIES})
4141
+ Python3::Module)
42-
42+
4343
target_include_directories(
4444
pybind11_native_proto_caster
4545
+ PUBLIC
4646
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
4747
PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
4848
${pybind11_INCLUDE_DIRS})
49-
49+
5050
@@ -109,7 +113,7 @@ target_link_libraries(
5151
absl::optional
5252
protobuf::libprotobuf
5353
pybind11::pybind11
5454
- ${Python_LIBRARIES})
5555
+ Python3::Module)
56-
56+
5757
target_include_directories(
5858
pybind11_wrapped_proto_caster
59-
diff --git a/pybind11_protobuf/proto_cast_util.cc b/pybind11_protobuf/proto_cast_util.cc
60-
index 06bde44..1cc6a30 100644
61-
--- a/pybind11_protobuf/proto_cast_util.cc
62-
+++ b/pybind11_protobuf/proto_cast_util.cc
63-
@@ -599,13 +599,14 @@ absl::optional<std::string> PyProtoDescriptorName(py::handle py_proto) {
64-
65-
bool PyProtoIsCompatible(py::handle py_proto, const Descriptor* descriptor) {
66-
assert(PyGILState_Check());
67-
- if (descriptor->file()->pool() != DescriptorPool::generated_pool()) {
68-
- /// This indicates that the C++ descriptor does not come from the C++
69-
- /// DescriptorPool. This may happen if the C++ code has the same proto
70-
- /// in different descriptor pools, perhaps from different shared objects,
71-
- /// and could be result in undefined behavior.
72-
- return false;
73-
- }
74-
+ // if (descriptor->file()->pool() != DescriptorPool::generated_pool()) {
75-
+ // /// This indicates that the C++ descriptor does not come from the C++
76-
+ // /// DescriptorPool. This may happen if the C++ code has the same proto
77-
+ // /// in different descriptor pools, perhaps from different shared objects,
78-
+ // /// and could be result in undefined behavior.
79-
+ // std::cout << " * Different";
80-
+ // return false;
81-
+ // }
82-
83-
auto py_descriptor = ResolveAttrs(py_proto, {"DESCRIPTOR"});
84-
if (!py_descriptor) {

0 commit comments

Comments
 (0)