Comment #2 on issue 208 by kleptog: python: constructor does not type check scalar values
http://code.google.com/p/protobuf/issues/detail?id=208

Attached is a patch which fixes the above.

While testing this locally I found that it revealed problems in the test suite where fields that weren't needed for the test were filled with None. As long as you don't try to serialise the object it's fine. It is a backward compatibility issue though.

What I'm thinking is an enhancement where if the constructor is given "field=None" that the field is simply skipped. This is meaningful since None is never a valid value for any message type. Implementing this is a matter of changing the final else to "elif field_value is not None:". I would like that but it's an API change so not appropriate for this issue.

Attachments:
        initfields.patch  432 bytes

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to