I'm confused.  If Python knows about the extensions, why is there a problem?
 It should parse them just fine -- they won't be "unknown fields" at all.

On Mon, Jan 11, 2010 at 11:17 AM, Carson <fenim...@gmail.com> wrote:

> Assume the case where a toolkit written in c++ that produces protobuf
> Message containers (Messages with only exensions) and and "passes"
> them to python.  Further assume the c++ code that did the
> deserialization had no knowledge of the extensions in that object; as
> a result, the deserialized message has only unknown fields.
>
> Right now python doesn't appear to pass along the unknown fields.
> However, if the python code does know what extensions are available,
> one solution for "passing" the message from c++ to python is to use
> the UnknownFieldSet to do a reflection-based copy.  We are primarily
> interested in copying extensions of type Message.
>
> First, we can build a map of known extensions (indexed by field
> number).  Then, during the copy, we use the unknown field type to
> determine how to copy each field. Messages appear to be length-
> delimited fields (strings use this type too).  We call ParseFromString
> with the value of the length-delimited unknown fields.
>
> This solution seems to work: entirely message-based extensions show up
> on the python side.  Just curious: has anyone else had to deal with
> this type of problem?
>
> --
> 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<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>
>
>
--
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