google-protobuf 3.20.0 → 3.21.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of google-protobuf might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfc78bfbc74c2a67555ba7fccbf76389e272f9a128b90bbd5f102b8d20267db4
|
4
|
+
data.tar.gz: d3337970c66cc241eabb5985c122e3301638fa02716e1d3e3d084ce04afbda51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cfe67b6db4b79c185e692ea86f1ec1cdaee1adefb64f54b8b7749a4e848a9c4522a85f097c84254629ac455562f32e527f87eb9905ee4700de882e5be675d10
|
7
|
+
data.tar.gz: cb12a265aff246ba44e6de50439a56ea45973e1303648bb35e0987955e1533dbb8bd16f2cd9f6bce094fee1c5fbf493bd09967e520f1b9fe879b23bd0f5e213a
|
@@ -1290,15 +1290,22 @@ VALUE build_module_from_enumdesc(VALUE _enumdesc) {
|
|
1290
1290
|
int n = upb_EnumDef_ValueCount(e);
|
1291
1291
|
for (int i = 0; i < n; i++) {
|
1292
1292
|
const upb_EnumValueDef* ev = upb_EnumDef_Value(e, i);
|
1293
|
-
|
1293
|
+
upb_Arena* arena = upb_Arena_New();
|
1294
|
+
const char* src_name = upb_EnumValueDef_Name(ev);
|
1295
|
+
char* name = upb_strdup2(src_name, strlen(src_name), arena);
|
1294
1296
|
int32_t value = upb_EnumValueDef_Number(ev);
|
1295
1297
|
if (name[0] < 'A' || name[0] > 'Z') {
|
1296
|
-
|
1298
|
+
if (name[0] >= 'a' && name[0] <= 'z') {
|
1299
|
+
name[0] -= 32; // auto capitalize
|
1300
|
+
} else {
|
1301
|
+
rb_warn(
|
1297
1302
|
"Enum value '%s' does not start with an uppercase letter "
|
1298
1303
|
"as is required for Ruby constants.",
|
1299
1304
|
name);
|
1305
|
+
}
|
1300
1306
|
}
|
1301
1307
|
rb_define_const(mod, name, INT2NUM(value));
|
1308
|
+
upb_Arena_Free(arena);
|
1302
1309
|
}
|
1303
1310
|
|
1304
1311
|
rb_define_singleton_method(mod, "lookup", enum_lookup, 1);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
#if (defined(__ARM_NEON) && defined(__aarch64__)) || defined(__SSE4_1__)
|
2
|
+
#if ((defined(__ARM_NEON) && defined(__aarch64__)) || defined(__SSE4_1__)) && !defined(TRUFFLERUBY)
|
3
3
|
int utf8_range2(const unsigned char* data, int len);
|
4
4
|
#else
|
5
5
|
int utf8_naive(const unsigned char* data, int len);
|
@@ -79,12 +79,25 @@ module Google
|
|
79
79
|
|
80
80
|
|
81
81
|
def first(n=nil)
|
82
|
-
n
|
82
|
+
if n.nil?
|
83
|
+
return self[0]
|
84
|
+
elsif n < 0
|
85
|
+
raise ArgumentError, "negative array size"
|
86
|
+
else
|
87
|
+
return self[0...n]
|
88
|
+
end
|
83
89
|
end
|
84
90
|
|
85
91
|
|
86
92
|
def last(n=nil)
|
87
|
-
n
|
93
|
+
if n.nil?
|
94
|
+
return self[-1]
|
95
|
+
elsif n < 0
|
96
|
+
raise ArgumentError, "negative array size"
|
97
|
+
else
|
98
|
+
start = [self.size-n, 0].max
|
99
|
+
return self[start...self.size]
|
100
|
+
end
|
88
101
|
end
|
89
102
|
|
90
103
|
|
data/tests/basic.rb
CHANGED
@@ -66,8 +66,11 @@ module BasicTest
|
|
66
66
|
def test_issue_8559_crash
|
67
67
|
msg = TestMessage.new
|
68
68
|
msg.repeated_int32 = ::Google::Protobuf::RepeatedField.new(:int32, [1, 2, 3])
|
69
|
-
|
70
|
-
|
69
|
+
|
70
|
+
# https://github.com/jruby/jruby/issues/6818 was fixed in JRuby 9.3.0.0
|
71
|
+
if cruby_or_jruby_9_3_or_higher?
|
72
|
+
GC.start(full_mark: true, immediate_sweep: true)
|
73
|
+
end
|
71
74
|
TestMessage.encode(msg)
|
72
75
|
end
|
73
76
|
|
@@ -79,6 +82,34 @@ module BasicTest
|
|
79
82
|
assert_equal 8, msg.id
|
80
83
|
end
|
81
84
|
|
85
|
+
def test_issue_9507
|
86
|
+
pool = Google::Protobuf::DescriptorPool.new
|
87
|
+
pool.build do
|
88
|
+
add_message "NpeMessage" do
|
89
|
+
optional :type, :enum, 1, "TestEnum"
|
90
|
+
optional :other, :string, 2
|
91
|
+
end
|
92
|
+
add_enum "TestEnum" do
|
93
|
+
value :Something, 0
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
msgclass = pool.lookup("NpeMessage").msgclass
|
98
|
+
|
99
|
+
m = msgclass.new(
|
100
|
+
other: "foo" # must be set, but can be blank
|
101
|
+
)
|
102
|
+
|
103
|
+
begin
|
104
|
+
encoded = msgclass.encode(m)
|
105
|
+
rescue java.lang.NullPointerException
|
106
|
+
flunk "NPE rescued"
|
107
|
+
end
|
108
|
+
decoded = msgclass.decode(encoded)
|
109
|
+
decoded.inspect
|
110
|
+
decoded.to_proto
|
111
|
+
end
|
112
|
+
|
82
113
|
def test_has_field
|
83
114
|
m = TestSingularFields.new
|
84
115
|
assert !m.has_singular_msg?
|
@@ -145,7 +176,7 @@ module BasicTest
|
|
145
176
|
m = TestSingularFields.new
|
146
177
|
|
147
178
|
m.singular_int32 = -42
|
148
|
-
assert_equal -42, m.singular_int32
|
179
|
+
assert_equal( -42, m.singular_int32 )
|
149
180
|
m.clear_singular_int32
|
150
181
|
assert_equal 0, m.singular_int32
|
151
182
|
|
@@ -540,8 +571,6 @@ module BasicTest
|
|
540
571
|
|
541
572
|
|
542
573
|
def test_json_maps
|
543
|
-
# TODO: Fix JSON in JRuby version.
|
544
|
-
return if RUBY_PLATFORM == "java"
|
545
574
|
m = MapMessage.new(:map_string_int32 => {"a" => 1})
|
546
575
|
expected = {mapStringInt32: {a: 1}, mapStringMsg: {}, mapStringEnum: {}}
|
547
576
|
expected_preserve = {map_string_int32: {a: 1}, map_string_msg: {}, map_string_enum: {}}
|
@@ -555,8 +584,6 @@ module BasicTest
|
|
555
584
|
end
|
556
585
|
|
557
586
|
def test_json_maps_emit_defaults_submsg
|
558
|
-
# TODO: Fix JSON in JRuby version.
|
559
|
-
return if RUBY_PLATFORM == "java"
|
560
587
|
m = MapMessage.new(:map_string_msg => {"a" => TestMessage2.new(foo: 0)})
|
561
588
|
expected = {mapStringInt32: {}, mapStringMsg: {a: {foo: 0}}, mapStringEnum: {}}
|
562
589
|
|
@@ -566,8 +593,6 @@ module BasicTest
|
|
566
593
|
end
|
567
594
|
|
568
595
|
def test_json_emit_defaults_submsg
|
569
|
-
# TODO: Fix JSON in JRuby version.
|
570
|
-
return if RUBY_PLATFORM == "java"
|
571
596
|
m = TestSingularFields.new(singular_msg: proto_module::TestMessage2.new)
|
572
597
|
|
573
598
|
expected = {
|
@@ -590,8 +615,6 @@ module BasicTest
|
|
590
615
|
end
|
591
616
|
|
592
617
|
def test_respond_to
|
593
|
-
# This test fails with JRuby 1.7.23, likely because of an old JRuby bug.
|
594
|
-
return if RUBY_PLATFORM == "java"
|
595
618
|
msg = MapMessage.new
|
596
619
|
assert msg.respond_to?(:map_string_int32)
|
597
620
|
assert !msg.respond_to?(:bacon)
|
@@ -666,5 +689,51 @@ module BasicTest
|
|
666
689
|
m2 = proto_module::TestMessage.decode(proto_module::TestMessage.encode(m))
|
667
690
|
assert_equal m2, m
|
668
691
|
end
|
692
|
+
|
693
|
+
def test_map_fields_respond_to? # regression test for issue 9202
|
694
|
+
msg = proto_module::MapMessage.new
|
695
|
+
assert msg.respond_to?(:map_string_int32=)
|
696
|
+
msg.map_string_int32 = Google::Protobuf::Map.new(:string, :int32)
|
697
|
+
assert msg.respond_to?(:map_string_int32)
|
698
|
+
assert_equal( Google::Protobuf::Map.new(:string, :int32), msg.map_string_int32 )
|
699
|
+
assert msg.respond_to?(:clear_map_string_int32)
|
700
|
+
msg.clear_map_string_int32
|
701
|
+
|
702
|
+
assert !msg.respond_to?(:has_map_string_int32?)
|
703
|
+
assert_raise NoMethodError do
|
704
|
+
msg.has_map_string_int32?
|
705
|
+
end
|
706
|
+
assert !msg.respond_to?(:map_string_int32_as_value)
|
707
|
+
assert_raise NoMethodError do
|
708
|
+
msg.map_string_int32_as_value
|
709
|
+
end
|
710
|
+
assert !msg.respond_to?(:map_string_int32_as_value=)
|
711
|
+
assert_raise NoMethodError do
|
712
|
+
msg.map_string_int32_as_value = :boom
|
713
|
+
end
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
717
|
+
def test_oneof_fields_respond_to? # regression test for issue 9202
|
718
|
+
msg = proto_module::OneofMessage.new
|
719
|
+
# `has_` prefix + "?" suffix actions should only work for oneofs fields.
|
720
|
+
assert msg.has_my_oneof?
|
721
|
+
assert msg.respond_to? :has_my_oneof?
|
722
|
+
assert !msg.respond_to?( :has_a? )
|
723
|
+
assert_raise NoMethodError do
|
724
|
+
msg.has_a?
|
725
|
+
end
|
726
|
+
assert !msg.respond_to?( :has_b? )
|
727
|
+
assert_raise NoMethodError do
|
728
|
+
msg.has_b?
|
729
|
+
end
|
730
|
+
assert !msg.respond_to?( :has_c? )
|
731
|
+
assert_raise NoMethodError do
|
732
|
+
msg.has_c?
|
733
|
+
end
|
734
|
+
assert !msg.respond_to?( :has_d? )
|
735
|
+
assert_raise NoMethodError do
|
736
|
+
msg.has_d?
|
737
|
+
end
|
669
738
|
end
|
670
739
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.21.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Protobuf Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler-dock
|
@@ -109,7 +109,7 @@ homepage: https://developers.google.com/protocol-buffers
|
|
109
109
|
licenses:
|
110
110
|
- BSD-3-Clause
|
111
111
|
metadata:
|
112
|
-
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.
|
112
|
+
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.21.10/ruby
|
113
113
|
post_install_message:
|
114
114
|
rdoc_options: []
|
115
115
|
require_paths:
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.3.
|
128
|
+
rubygems_version: 3.0.3.1
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Protocol Buffers
|