pybind / pybind11_protobuf

Pybind11 bindings for Google's Protocol Buffers
Other
57 stars 35 forks source link

Only allow direct use of messages that share the same default_pool instance. #54

Closed copybara-service[bot] closed 2 years ago

copybara-service[bot] commented 2 years ago

Only allow direct use of messages that share the same default_pool instance.

There's no guarantee of API/ABI equivalence across .so boundaries, so ensuring the default_pool() instance is the same pointer is probably as close as we can achieve right now. Ideally there would be a mechanism to ensure that PyProto_API uses the same generated_pool(), but GetDefaultDescriptorPool() returns a DescriptorPool where generated_pool() is an underlay and inaccessible.

In light of this, modify the compatibility checks for concrete C++ messages to remove PyCompatibleDescriptor and impose a few more restrictions on concrete message types.

In addition to the new changes, this is a partial rollback of commit 32365371e06337083893addb166e45a12d7c6a6e commit 30f02dd9ccd2fc7046c36ed913ed510fd1aa7301

Specifically the PyPinDescriptorPool and PyCompatibleDescriptor.