Clarifying for Sharing Messages Between Python and C++

462 views
Skip to first unread message

No AnyLove (NoAnyLove)

unread,
Nov 3, 2022, 1:32:51 AM11/3/22
to Protocol Buffers
Protobuf Python has switched to upb as default backend since 21.0, according to the release notes, which significantly improves the performance. But according to notes here and here, it implies the upb backend causes break when it shares messages between Python and C++.

I'm a little bit confused here, as it can refer to 2 different situations,

    A Python app uses C++ extension, which passes the protobuf message objects between each other via function/class calls
    A Python app and a C++ app transmit protobuf messages via socket/pipe/etc., i.e., it needs to serialize/deserialize the messages

According to the following note and protobuf advertising it as language-neutral, I assume the break only happens in the 1st situation, but want to double check that I'm not making mistake here.

> Prior to Python 4.21.0, Python apps could share messages with C++ using a native extension.

Thanks.

Adam Cozzette

unread,
Nov 3, 2022, 11:22:46 AM11/3/22
to No AnyLove (NoAnyLove), Protocol Buffers
Yes, you are right. Serializing a message and parsing it back on the other side will always work, but starting from 4.21.0, Python apps won't be able to share messages directly without that step.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/7c32529f-ac86-4207-a9a1-2865cbf4661an%40googlegroups.com.

NoAnyLove (NoAnyLove)

unread,
Nov 3, 2022, 2:05:08 PM11/3/22
to Protocol Buffers
I see, thanks!
Reply all
Reply to author
Forward
0 new messages