1. getter function to access the upb_Map corresponding to a map proto field
2. conversion function to get a Go map from a upb_Map. The conversion function uses generics, so it must be a standalone function independent of `MessageAccessor`.
Accessing map fields is not as efficient as accessing other proto field types, because of two reasons:
- we need to make a copy of map values in Go, since the memory representations are different in UPB C
- we need to call C functions from Go, because the upb_Map struct fields are not exported and we can't access the bits directly, causing performance overhead
Luckily the map fields can be quite rare, so the performance overhead should not be too significant overall.
PiperOrigin-RevId: 559191359
The Python comparison protocol requires that if an object doesn't know how to
compare itself to an object of a different type, it returns NotImplemented
rather than False. The interpreter will then try performing the comparison using
the other operand. This translates, for protos, to:
If a proto message doesn't know how to compare itself to an object of
non-message type, it returns NotImplemented. This way, the interpreter will then
try performing the comparison using the comparison methods of the other object,
which may know how to compare itself to a message. If not, then Python will
return the combined result (e.g., if both objects don't know how to perform
__eq__, then the equality operator `==` return false).
This change allows one to compare a proto with custom matchers such as mock.ANY
that the message doesn't know how to compare to, regardless of whether
mock.ANY is on the right-hand side or left-hand side of the equality (prior to
this change, it only worked with mock.ANY on the left-hand side).
See https://github.com/protocolbuffers/protobuf/issues/9173
PiperOrigin-RevId: 559056804
Remove message/message.h as a hdr from :message_internal
Lock down the visibility of :message_types to upb-only
message/types.h is not an internal header because the definitions there are part of the public surface. But the fact that it needs to exist is an implementation detail that should remain opaque, so make it a private dep.
PiperOrigin-RevId: 558960776
Remove array.h and map.h as hdrs from :collections_internal
Remove alloc.h and arena.h as hdrs from :mem_internal (and add them to :mem)
Remove common.h and decode.h and encode.h as hdrs from :wire_internal
Lock down the visibility of :wire_internal to upb-only
Merge :mini_descriptor_encode_internal into :mini_descriptor_internal
PiperOrigin-RevId: 558235138
This will allow us to run the CMake test from within the protobuf repo's Bazel
workspace. The directory structure is a little bit different depending on which
workspace the test is invoked in.
PiperOrigin-RevId: 557275295
I found that this test fails when I try to run it from our protobuf repo CI
setup, probably because rsync is not available in the Docker image there. Let's
just use `cp` instead so that the test works even if rsync is unavailable.
PiperOrigin-RevId: 557225733
When build a FileDescriptorProto into pool, FieldDescriptorProto.type may not set if type_name is set. Runtime Change. To make copybara happy, tests will be added in a separate change
PiperOrigin-RevId: 553881407
The file structure was broken only when invoking from protobuf repo (`bazel build @upb//python/dist:source_tarball`) since filegroup files have a path like `protobuf/external/upb/python/dist/setup.py` rather than `protobuf/setup.py`
This was broken by 79af13abde
PiperOrigin-RevId: 553821217
Clang and GCC differ on how they detect Address Sanitizer. Support both.
Closes#1424
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/upb/pull/1424 from protocolbuffers:asan-clang 491a5ee4cfd24c8eb281f894de0cf4384525c46a
PiperOrigin-RevId: 553805994
When build a FileDescriptorProto into pool, FieldDescriptorProto.type may not set if type_name is set. Runtime Change. To make copybara happy, tests will be added in a separate change
PiperOrigin-RevId: 553598520
This flag was added to Protobuf and submitted separately due to version skew between repos.
This attempts to fix the following error from local and release settings both matching.
```
ERROR: /workspace/_build/out/external/upb/python/dist/BUILD.bazel:251:9: Illegal ambiguous match on configurable attribute "platform" in @upb//python/dist:binary_wheel:
@upb//python/dist:linux_x86_64_local
@upb//python/dist:windows_x86_64
Multiple matches are not allowed unless one is unambiguously more specialized or they resolve to the same value. See https://bazel.build/reference/be/functions#select.
```
PiperOrigin-RevId: 553226261
The next in a series of CLs to split upb/BUILD into subdirs.
Create mem/internal/
Delete the deprecated upb/arena.h and upb/alloc.h stub headers
PiperOrigin-RevId: 552864952
When build a FileDescriptorProto into pool, FieldDescriptorProto.type may not set if type_name is set. Runtime Change. To make copybara happy, tests will be added in a separate change
PiperOrigin-RevId: 552521056