Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: accessing an unset struct_pb2.Value field does not raise #140

Merged
merged 1 commit into from Oct 1, 2020
Merged

fix: accessing an unset struct_pb2.Value field does not raise #140

merged 1 commit into from Oct 1, 2020

Commits on Oct 1, 2020

  1. fix: accessing an unset struct_pb2.Value field does not raise

    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.
    software-dov committed Oct 1, 2020
    Configuration menu
    Copy the full SHA
    dfe264d View commit details
    Browse the repository at this point in the history