Hong Shin
0730adb1c1
rename upb_Message_WhichOneof to upb_Message_WhichOneofByDef
...
and introduce upb_Message_WhichOneof that returns a minitable field without needing reflection
PiperOrigin-RevId: 637932147
7 months ago
Protobuf Team Bot
f65108072b
Fixed printing of nan floats/doubles in Python.
...
The second assert in _upb_EncodeRoundTripFloat is raised if val is a nan. This fix just returns the output of first spnprintf.
I am not sure how changes to this repo are made so feel free to ignore this CL.
To test this, you could
1. Define a proto with a float field
message Test {
float val = 1;
}
2. In a python script, import the library and then set the val to nan and try to print it.
proto = Test(val=float('nan'))
print(proto)
This will cause a coredump due to assertion error:
assert.h assertion failed at third_party/upb/upb/lex/round_trip.c:46 in void _upb_EncodeRoundTripFloat(float, char *, size_t): strtof(buf, NULL) == val
Added the corresponding change to double too
PiperOrigin-RevId: 637127851
7 months ago
Protobuf Team Bot
2e9c0a7ece
Auto-generate files after cl/635956805
7 months ago
Mike Kruskal
e237f72bc4
Future-proof edition 2023 against feature value support windows.
...
This "feature" hasn't been implemented yet, but this puts a placeholder down to prevent compatibility issues in future editions. Once we provide versioning support on individual feature values, we don't want them becoming usable from edition 2023 protos
PiperOrigin-RevId: 635956805
7 months ago
Protobuf Team Bot
5fb5b871dc
Remove spurious 'return' in a void function of another void.
...
PiperOrigin-RevId: 635530952
7 months ago
Hong Shin
0645439efa
Introduce upb_EncodeStatus_String and upb_DecodeStatus_String
...
Wrapper languages can now use these helpers to get human-friendly
error codes as opposed to manually re-mapping.
PiperOrigin-RevId: 634112262
7 months ago
pbatg
30a40eefe5
Fixed broken link in upb README.md ( #16717 )
...
I noticed this link was broken. I'm not familiar with the project, but the code in https://github.com/protocolbuffers/protobuf/tree/main/upb/python does appear to import upb headers, so I think it's the right URL.
Closes #16717
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16717 from pbatg:patch-1 c9e654308d
PiperOrigin-RevId: 633589882
7 months ago
Eric Salo
f93565c20c
upb: publish and start using the new non-universal setters out in the wild
...
PiperOrigin-RevId: 632663127
7 months ago
Hong Shin
d071c60878
Break out idx in upb_MiniTableSub computation for clarity
...
PiperOrigin-RevId: 632314763
7 months ago
Éamonn McManus
b5fc2735e9
In `upb_MiniTableExtension_GetSubMessage`, return NULL for non-messages.
...
This parallels the logic in `upb_MiniTable_SubMessage`.
PiperOrigin-RevId: 632277936
7 months ago
Eric Salo
6245733655
upb: remove the unused (upb_MiniTable*) arg from upb_Message_SetMessage()
...
PiperOrigin-RevId: 632267379
7 months ago
Eric Salo
d923896299
upb: implement most of the non-universal setters
...
PiperOrigin-RevId: 631620526
7 months ago
Eric Salo
65821a67d6
upb: finish cleaning up message/accessors.h and message/internal/accessors.h
...
PiperOrigin-RevId: 631612923
7 months ago
Hong Shin
6ccda4d2b5
Add upb_Message_ClearOneof (and retain upb_Message_WhichOneofFieldNumber)
...
upb users currently need to manually fetch a oneof field in order to clear it.
In this CL, we add a convenience method to do that in one fell swoop.
PiperOrigin-RevId: 631454136
7 months ago
Eric Salo
18306666b9
upb: clean up the UPB_TRACING_ENABLED code
...
PiperOrigin-RevId: 631023575
7 months ago
Eric Salo
aa70a3576b
upb: clean up message/accessors.h and message/internal/accessors.h
...
PiperOrigin-RevId: 630466865
7 months ago
Protobuf Team Bot
d3b2fc52a4
Auto-generate files after cl/630090538
7 months ago
Protobuf Team Bot
c9eeb1c8a7
Internal changes.
...
PiperOrigin-RevId: 630090538
7 months ago
Éamonn McManus
b4f4f8ef65
Automated rollback of commit 7a09c4569b
.
...
PiperOrigin-RevId: 629808114
7 months ago
Hong Shin
7a09c4569b
Add upb_Message_ClearOneof
...
upb users currently need to manually fetch a oneof field in order to clear it.
In this CL, we add a convenience method to do that in one fell swoop.
PiperOrigin-RevId: 629782904
7 months ago
Protobuf Team Bot
12a828c700
Add UPB_ASSUME(!IsExtension) on GetMutableMessage.
...
This function is UB to call on an extension field.
PiperOrigin-RevId: 629701038
7 months ago
Hong Shin
52c12a6f92
Automated rollback of commit 208cae7fd7
.
...
PiperOrigin-RevId: 629424223
7 months ago
Hong Shin
208cae7fd7
Internal Change
...
PiperOrigin-RevId: 629226391
7 months ago
Éamonn McManus
501067aa80
Expose `MiniDescriptorEncode` for `FieldDefPtr`.
...
We already expose equivalent methods for `MessageDefPtr` and `EnumDefPtr`.
PiperOrigin-RevId: 629150393
8 months ago
Protobuf Team Bot
62f2b143d5
Change the arena.hpp ::Fuse return type to bool to surface whether the fuse failed.
...
PiperOrigin-RevId: 628161481
8 months ago
Hong Shin
e0fc566596
Ensure the appropriate upb functions taking non-const pointers assert that the message is not frozen.
...
Fixes message/promote.c and internal/extension.c.
PiperOrigin-RevId: 628095780
8 months ago
Eric Salo
8be1312b3c
upb: fix Dart empty imports
...
PiperOrigin-RevId: 627794151
8 months ago
Hong Shin
5b5db6666e
Check IsFrozen for internal/message.c and reflection/message.c
...
PiperOrigin-RevId: 627531912
8 months ago
Hong Shin
bd9f211f97
Remove IsFrozen checks from upb/conformance
...
PiperOrigin-RevId: 627492449
8 months ago
Hong Shin
bceb7f597f
Check IsFrozen for message/copy.c, experimental_jspb/decode.c, and json/decode.c
...
PiperOrigin-RevId: 627468915
8 months ago
Hong Shin
0e3650c29c
Add IsFrozen checks to conformance_upb and upb_js
...
PiperOrigin-RevId: 627419894
8 months ago
Hong Shin
335edb909f
update decode_fast.c to assert that non-const messages are not frozen
...
PiperOrigin-RevId: 627393634
8 months ago
Joshua Haberman
37e484a0aa
Replace direct access to MiniTable subs with calls to the encapsulated functions.
...
PiperOrigin-RevId: 626485595
8 months ago
Protobuf Team Bot
6afdd5a135
Auto-generate files after cl/625815212
8 months ago
Mike Kruskal
e5502c746e
Removed merged features from the edition defaults IR.
...
All of this information is still available by merging fixed_features and overridable_features. This new split will make validation easier for runtimes that need to do dynamic builds.
PiperOrigin-RevId: 625815212
8 months ago
Mike Kruskal
db5814e4ff
Use newly split feature defaults in plugins and runtimes.
...
The new fields fixed_features and overridable_features can be simply merged to recover the old aggregate defaults. By splitting them though, plugins and runtimes get some extra information about lifetimes for enforcement.
PiperOrigin-RevId: 625527117
8 months ago
Joshua Haberman
b9b735cc73
Internal change
...
PiperOrigin-RevId: 625502066
8 months ago
Mike Kruskal
ea81024ddf
Refactor editions infrastructure to a top-level directory.
...
The only public target here is the edition defaults helper macro, which can be used by external runtimes and plugins. None of this code is C++-specific though, and should be organized higher up. Appropriate aliases are also placed at the top level for public targets
PiperOrigin-RevId: 625392504
8 months ago
Eric Salo
bb3e50e15e
upb: implement Dart public imports
...
PiperOrigin-RevId: 625324587
8 months ago
Protobuf Team Bot
a5be8bdb9f
Auto-generate files after cl/625084569
8 months ago
Eric Salo
8d025c08ff
upb: implement named imports in Dart
...
PiperOrigin-RevId: 624186848
8 months ago
Mike Kruskal
7d87a1780a
Hook up staleness tests to non-bootstrap edition defaults
...
PiperOrigin-RevId: 623936729
8 months ago
Protobuf Team Bot
2322a8720f
Auto-generate files after cl/623529512
8 months ago
Mike Kruskal
da651cd3c2
Restore legacy edition enum value
...
PiperOrigin-RevId: 623529512
8 months ago
Protobuf Team Bot
b8bb56df4c
Change Rust-upb to use upb_Encode and upb_Decode directly, instead of going through the upb C gencode.
...
PiperOrigin-RevId: 623474125
8 months ago
Protobuf Team Bot
ac32c97fbf
Auto-generate files after cl/623355801
8 months ago
Eric Salo
9118be944d
upb: extension/basefield setters are now public functions
...
PiperOrigin-RevId: 623355801
8 months ago
Éamonn McManus
0013736b04
Fix typo in `kUpb_EncodeOption_SkipUnkown`.
...
It is about encoding, not printing.
PiperOrigin-RevId: 622979373
8 months ago
Hong Shin
09529fe018
Update reader.c to initialize i inside loop
...
PiperOrigin-RevId: 622958098
8 months ago
Eric Salo
52aa23f3fc
upb: reuse upb_Message_Internal buffer after a upb_Message_Clear()
...
PiperOrigin-RevId: 622913413
8 months ago