This repository was archived by the owner on Feb 23, 2026. It is now read-only.
fix: accessing an unset struct_pb2.Value field does not raise#140
Merged
software-dov merged 1 commit intogoogleapis:masterfrom Oct 1, 2020
software-dov:null-struct-value
Merged
fix: accessing an unset struct_pb2.Value field does not raise#140software-dov merged 1 commit intogoogleapis:masterfrom software-dov:null-struct-value
software-dov merged 1 commit intogoogleapis:masterfrom
software-dov:null-struct-value
Conversation
class Foo(proto.Message):
value = proto.Field(struct_pb2.Value, number=1)
f = Foo()
assert f.value is None # This should not raise an exception.
assert "value" not in f # The attribute has _not_ been set.
f.value = None
assert f.value is None
assert "value" in f # The attribute _has_ been set.
None of the above should raise an exception.
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 20 20
Lines 857 856 -1
Branches 149 148 -1
=========================================
- Hits 857 856 -1
Continue to review full report at Codecov.
|
busunkim96
approved these changes
Oct 1, 2020
gcf-merge-on-green bot
pushed a commit
that referenced
this pull request
Oct 8, 2020
🤖 I have created a release \*beep\* \*boop\* --- ### [1.10.1](https://www.github.com/googleapis/proto-plus-python/compare/v1.10.0...v1.10.1) (2020-10-08) ### Bug Fixes * accessing an unset struct_pb2.Value field does not raise ([#140](https://www.github.com/googleapis/proto-plus-python/issues/140)) ([d045cbf](https://www.github.com/googleapis/proto-plus-python/commit/d045cbf058cbb8f4ca98dd06741270fcaee865be)) * add LICENSE and tests to package ([#146](https://www.github.com/googleapis/proto-plus-python/issues/146)) ([815c943](https://www.github.com/googleapis/proto-plus-python/commit/815c9439a1dadb2d4111784eb18ba673ce6e6cc2)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
None of the above should raise an exception.
Closes #139