[Pkg-protobuf-devel] Bug#835271: python-protobuf returns " TypeError: Descriptors should not be created directly, but only retrieved from their parent" message

Antonio Ospite ao2 at ao2.it
Thu Aug 25 08:10:02 UTC 2016


On Wed, 24 Aug 2016 13:29:01 +0200
Antonio Ospite <ao2 at ao2.it> wrote:

> Package: python-protobuf
> Followup-For: Bug #835271
> 
> Dear Maintainer,
> 
> this bug affects also all the software using python-axolotl like for
> instance gajim.
> 
> For now I worked around the issue by downgrading to python-protobuf_2.6.1-2
> which is still available in the archives:
> http://debian.sil.at/debian/pool/main/p/protobuf/
> 
> The reason why the OP does not see the issue in PyPy is in the code:
> https://github.com/google/protobuf/blob/2fe0556c7abbe31c02147b9171397737a35bfe3b/python/google/protobuf/pyext/descriptor.cc#L94
> 
> These new checks in 3.0.x (mainly that the file ends with "_pb2.py") are
> not executed when the module is compiled for PyPy.
> 
> The problem may as well be in python-axolotl, I see that in
> /usr/lib/python2.7/dist-packages/axolotl/protocol/whisperprotos.py both
> descriptor and descriptor_pb2 are imported, but apparently with protobuf
> 3.0.x only the second one is supposed to be used directly.
> 
> Any idea about how to proceed from here?

OK, the issue is not directly about descriptor_pb2, but about the code
which uses protobuf in axolotl.

Basically newer protobuf version (when NOT using PyPy) check that the
generated protocol files still have the _pb2 suffix, in the case of
axolotl these are the files generated from axolotl/protobuf/*.proto,
namely axolotl/protocol/whisperprotos.py and
axolotl/state/storageprotos.py; renaming these to keep the _pb2
suffix fixes the issue.

See the attached patch, it's against
https://github.com/tgalal/python-axolotl.git and after applying it the
tests pass again.

I am going to submit a bug report to upstream python-axolotl as soon as
you confirm that the fix works for you too.

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Keep-the-_pb2-suffix-in-the-name-for-protobuf-genera.patch
Type: text/x-diff
Size: 8579 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-protobuf-devel/attachments/20160825/b8cbaf8a/attachment.patch>


More information about the Pkg-protobuf-devel mailing list