appnexus / pyrobuf

A Cython alternative to Google's Python Protobuf library
Other
554 stars 76 forks source link

Non-listed enum values are rejected during deserialization #149

Open thirtythreeforty opened 4 years ago

thirtythreeforty commented 4 years ago

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.