Skip to content

Commit

Permalink
Add `pybind11_protobuf::check_unknown_fields::ExtensionsWithUnknownFi…
Browse files Browse the repository at this point in the history
…eldsPolicy`.

BEGIN_PUBLIC

Add `pybind11_protobuf::check_unknown_fields::ExtensionsWithUnknownFieldsPolicy`.

END_PUBLIC

This feature is primarily to support rolling out PyCLIF-pybind11 (go/pyclif_pybind11_fusion) without first having to resolve the ~11.7k test failures shown under b/304628404.

In the presumably very rare cases that the serialize/parse runtime overhead is noticeable, `//third_party/pybind11_protobuf:disallow_extensions_with_unknown_fields` can be added to the `deps` of the affected `py_binary` (or `py_test`) targets, to thereby enforce that the required `cc_proto_library` dependencies are added.

PiperOrigin-RevId: 595557800
  • Loading branch information
rwgk committed Jan 22, 2024
1 parent 6c0d038 commit b74c5c1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clif/pybind11/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ def generate_from(self, ast: ast_pb2.AST):
if self._codegen_info.requires_status:
yield I + I + ('pybind11::module_::import('
'"util.task.python.error");')
yield I + I + 'pybind11_protobuf::check_unknown_fields::'
yield I + I + ' ExtensionsWithUnknownFieldsPolicy::'
yield I + I + ' WeakEnableFallbackToSerializeParse();'
yield I + I + 'pybind11_protobuf::ImportNativeProtoCasters();'

for decl in ast.decls:
Expand Down

0 comments on commit b74c5c1

Please sign in to comment.