Skip to content

Ruby oneofs: return default instead of nil for unset fields.#1558

Merged
haberman merged 2 commits intoprotocolbuffers:masterfrom
haberman:rubyoneof
May 19, 2016
Merged

Ruby oneofs: return default instead of nil for unset fields.#1558
haberman merged 2 commits intoprotocolbuffers:masterfrom
haberman:rubyoneof

Conversation

@haberman
Copy link
Member

No description provided.

@haberman
Copy link
Member Author

Review to @acozzette.

This is part of a general decision that oneof fields should return defaults when unset instead of nil.

}
}

VALUE value_from_default(const upb_fielddef *field) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this function be static since it is only called from within this file?

@acozzette
Copy link

LGTM

@haberman
Copy link
Member Author

I addressed your comment and also fixed JRuby. The enum behavior was slightly wrong also, so I've fixed that too. PTAL.

@acozzette
Copy link

LGTM

@seishun
Copy link
Contributor

seishun commented May 19, 2016

Is this the desired behavior for all languages? Because the JavaScript implementation does currently suffer from the same ailment: unset oneof fields return undefined (see #1447).

@haberman haberman merged commit cc5296b into protocolbuffers:master May 19, 2016
@haberman haberman deleted the rubyoneof branch January 2, 2019 23:21
copybara-service bot pushed a commit that referenced this pull request Apr 5, 2024
https://github.com/bazelbuild/rules_python/blob/main/python/private/proto/py_proto_library.bzl

Contributors:
d96214f tpudlik@google.com      Wed Nov 15 02:48:06 2023 -0800  fix: py_proto_library: transitive strip_import_prefix (#1558)
85e50d2 tpudlik@gmail.com       Tue Nov 14 06:04:59 2023 -0800  fix: py_proto_library: append to PYTHONPATH less (#1553)
bee35ef zplin@uber.com  Wed Oct 11 20:59:34 2023 -0700  fix: allowing to import code generated from proto with strip_import_prefix (#1406)
1a333ce ilist@google.com        Tue Jun 20 19:36:39 2023 +0200  fix: plugin_output in py_proto_library rule (#1280)
6905e63 ignas.anikevicius@woven-planet.global   Sat Feb 11 14:02:33 2023 +0900  fix: make py_proto_library respect PyInfo imports (#1046)
0d3c4f7 ilist@google.com        Wed Jan 18 23:15:52 2023 +0000  Implement py_proto_library (#832)
PiperOrigin-RevId: 621873066
copybara-service bot pushed a commit that referenced this pull request Apr 5, 2024
https://github.com/bazelbuild/rules_python/blob/main/python/private/proto/py_proto_library.bzl

Contributors:
d96214f tpudlik@google.com      Wed Nov 15 02:48:06 2023 -0800  fix: py_proto_library: transitive strip_import_prefix (#1558)
85e50d2 tpudlik@gmail.com       Tue Nov 14 06:04:59 2023 -0800  fix: py_proto_library: append to PYTHONPATH less (#1553)
bee35ef zplin@uber.com  Wed Oct 11 20:59:34 2023 -0700  fix: allowing to import code generated from proto with strip_import_prefix (#1406)
1a333ce ilist@google.com        Tue Jun 20 19:36:39 2023 +0200  fix: plugin_output in py_proto_library rule (#1280)
6905e63 ignas.anikevicius@woven-planet.global   Sat Feb 11 14:02:33 2023 +0900  fix: make py_proto_library respect PyInfo imports (#1046)
0d3c4f7 ilist@google.com        Wed Jan 18 23:15:52 2023 +0000  Implement py_proto_library (#832)
PiperOrigin-RevId: 621873066
copybara-service bot pushed a commit that referenced this pull request Apr 5, 2024
https://github.com/bazelbuild/rules_python/blob/main/python/private/proto/py_proto_library.bzl

Contributors:
d96214f tpudlik@google.com      Wed Nov 15 02:48:06 2023 -0800  fix: py_proto_library: transitive strip_import_prefix (#1558)
85e50d2 tpudlik@gmail.com       Tue Nov 14 06:04:59 2023 -0800  fix: py_proto_library: append to PYTHONPATH less (#1553)
bee35ef zplin@uber.com  Wed Oct 11 20:59:34 2023 -0700  fix: allowing to import code generated from proto with strip_import_prefix (#1406)
1a333ce ilist@google.com        Tue Jun 20 19:36:39 2023 +0200  fix: plugin_output in py_proto_library rule (#1280)
6905e63 ignas.anikevicius@woven-planet.global   Sat Feb 11 14:02:33 2023 +0900  fix: make py_proto_library respect PyInfo imports (#1046)
0d3c4f7 ilist@google.com        Wed Jan 18 23:15:52 2023 +0000  Implement py_proto_library (#832)
PiperOrigin-RevId: 621873066
copybara-service bot pushed a commit that referenced this pull request Apr 5, 2024
https://github.com/bazelbuild/rules_python/blob/main/python/private/proto/py_proto_library.bzl

Contributors:
d96214f tpudlik@google.com      Wed Nov 15 02:48:06 2023 -0800  fix: py_proto_library: transitive strip_import_prefix (#1558)
85e50d2 tpudlik@gmail.com       Tue Nov 14 06:04:59 2023 -0800  fix: py_proto_library: append to PYTHONPATH less (#1553)
bee35ef zplin@uber.com  Wed Oct 11 20:59:34 2023 -0700  fix: allowing to import code generated from proto with strip_import_prefix (#1406)
1a333ce ilist@google.com        Tue Jun 20 19:36:39 2023 +0200  fix: plugin_output in py_proto_library rule (#1280)
6905e63 ignas.anikevicius@woven-planet.global   Sat Feb 11 14:02:33 2023 +0900  fix: make py_proto_library respect PyInfo imports (#1046)
0d3c4f7 ilist@google.com        Wed Jan 18 23:15:52 2023 +0000  Implement py_proto_library (#832)
PiperOrigin-RevId: 621873066
copybara-service bot pushed a commit that referenced this pull request Apr 10, 2024
https://github.com/bazelbuild/rules_python/blob/main/python/private/proto/py_proto_library.bzl

Contributors:
d96214f tpudlik@google.com      Wed Nov 15 02:48:06 2023 -0800  fix: py_proto_library: transitive strip_import_prefix (#1558)
85e50d2 tpudlik@gmail.com       Tue Nov 14 06:04:59 2023 -0800  fix: py_proto_library: append to PYTHONPATH less (#1553)
bee35ef zplin@uber.com  Wed Oct 11 20:59:34 2023 -0700  fix: allowing to import code generated from proto with strip_import_prefix (#1406)
1a333ce ilist@google.com        Tue Jun 20 19:36:39 2023 +0200  fix: plugin_output in py_proto_library rule (#1280)
6905e63 ignas.anikevicius@woven-planet.global   Sat Feb 11 14:02:33 2023 +0900  fix: make py_proto_library respect PyInfo imports (#1046)
0d3c4f7 ilist@google.com        Wed Jan 18 23:15:52 2023 +0000  Implement py_proto_library (#832)
PiperOrigin-RevId: 621873066
copybara-service bot pushed a commit that referenced this pull request Apr 10, 2024
https://github.com/bazelbuild/rules_python/blob/main/python/private/proto/py_proto_library.bzl

Contributors:
d96214f tpudlik@google.com      Wed Nov 15 02:48:06 2023 -0800  fix: py_proto_library: transitive strip_import_prefix (#1558)
85e50d2 tpudlik@gmail.com       Tue Nov 14 06:04:59 2023 -0800  fix: py_proto_library: append to PYTHONPATH less (#1553)
bee35ef zplin@uber.com  Wed Oct 11 20:59:34 2023 -0700  fix: allowing to import code generated from proto with strip_import_prefix (#1406)
1a333ce ilist@google.com        Tue Jun 20 19:36:39 2023 +0200  fix: plugin_output in py_proto_library rule (#1280)
6905e63 ignas.anikevicius@woven-planet.global   Sat Feb 11 14:02:33 2023 +0900  fix: make py_proto_library respect PyInfo imports (#1046)
0d3c4f7 ilist@google.com        Wed Jan 18 23:15:52 2023 +0000  Implement py_proto_library (#832)
PiperOrigin-RevId: 623401031
deannagarcia pushed a commit to deannagarcia/protobuf that referenced this pull request Jun 20, 2024
https://github.com/bazelbuild/rules_python/blob/main/python/private/proto/py_proto_library.bzl

Contributors:
d96214f tpudlik@google.com      Wed Nov 15 02:48:06 2023 -0800  fix: py_proto_library: transitive strip_import_prefix (protocolbuffers#1558)
85e50d2 tpudlik@gmail.com       Tue Nov 14 06:04:59 2023 -0800  fix: py_proto_library: append to PYTHONPATH less (protocolbuffers#1553)
bee35ef zplin@uber.com  Wed Oct 11 20:59:34 2023 -0700  fix: allowing to import code generated from proto with strip_import_prefix (protocolbuffers#1406)
1a333ce ilist@google.com        Tue Jun 20 19:36:39 2023 +0200  fix: plugin_output in py_proto_library rule (protocolbuffers#1280)
6905e63 ignas.anikevicius@woven-planet.global   Sat Feb 11 14:02:33 2023 +0900  fix: make py_proto_library respect PyInfo imports (protocolbuffers#1046)
0d3c4f7 ilist@google.com        Wed Jan 18 23:15:52 2023 +0000  Implement py_proto_library (protocolbuffers#832)
PiperOrigin-RevId: 623401031
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants