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

Non-listed enum values are rejected during deserialization #149

Open
thirtythreeforty opened this issue Feb 27, 2020 · 0 comments
Open

Non-listed enum values are rejected during deserialization #149

thirtythreeforty opened this issue Feb 27, 2020 · 0 comments

Comments

@thirtythreeforty
Copy link
Contributor

When I attempt to deserialize an enum with a numeric value that isn't listed in the proto file, I get an exception:

  File "src/my_code/my_proto.pyx", line 2248, in my_proto.MyProto.epe.__set__
ValueError: 9 not a valid value for enum EPERange

The language guide says, however:

During deserialization, unrecognized enum values will be preserved in the message, though how this is represented when the message is deserialized is language-dependent.

Pyrobuf should allow deserializing and reserializing such messages.

thirtythreeforty added a commit to KopisMobile/pyrobuf that referenced this issue Feb 27, 2020
According to the language guide [1]:

    During deserialization, unrecognized enum values will be preserved
    in the message, though how this is represented when the message is
    deserialized is language-dependent.

We can store any integer in the underlying field, because in Cython,
enum and int are the same.

Fixes appnexus#149.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant