Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Protobuf 2.6.0 incompatibility issues with Python 3.x #7
Comments
xfxyjwf
added this to the Python 3 support milestone
Sep 3, 2014
|
Blanket Python 3 support was unintentionally listed in these release notes. We need to fix that up for a 2.6.x release. The code itself is ready with some 2to3 use, the setup.py and deps are not done yet. Sorry about that! Here's my summary:
protobuf/descriptor.py setup.py also specifies an external dep on google-apputils needed in order to run the unittests. We need to push out an updated version of that with Python 3 support. |
brettcannon
commented
Sep 4, 2014
|
Any specific reason for wanting to use 2to3 instead of something like https://github.com/python-modernize/python-modernize to do the transition once? |
borntyping
referenced this issue
in borntyping/python-riemann-client
Sep 5, 2014
Closed
python3 support #15
mrovner
commented
Sep 6, 2014
|
It says and it's not apparent why it's better ;) Also 2to3 support is in setuptools already. On Thu, Sep 4, 2014 at 6:59 AM, Brett Cannon notifications@github.com
Thanks, |
brettcannon
commented
Sep 7, 2014
|
By unifying the code base to work on both Python 2 and 3 it makes development easier and installation faster (unless you release separate Python 2 and 3 packages). By not having to wait for 2to3 you eliminate a compile step during development. As for installation, you can forgo that step entirely. Plus the coding practices used in converted source is more in line with modern best practices and syntax. |
Kentzo
commented
Sep 26, 2014
|
I wonder if we can reuse code from my https://github.com/GreatFruitOmsk/protobuf-py3 |
This was referenced Oct 14, 2014
|
I'm +1 on @Kentzo's approach, and would volunteer to help review #66. As @brettcannon says, avoiding 2to3 is pretty much the "widely accepted" best practice for libraries which need to support both Python2 and Python3: e.g., see Lennart Regebro's excellent outline of strategies. |
This was referenced Nov 19, 2014
virtuald
commented
Nov 21, 2014
|
I would love to see a python 3 compatible official protobuf available by Christmas. |
virtuald
commented
Nov 30, 2014
|
FWIW, using the current trunk of protobuf, the only change I had to make to the package after installation was change a number of str("", "utf-8") references in descriptor_pb2.py. Oddly enough, the protobuf I have installed from homebrew (2.6.1) generates _pb2.py files with a function that looks like this:
And it uses that to encode strings instead like this:
So.. not sure why the descriptor_pb2.py file is out of date. If someone could push those changes into that file, then I believe trunk would at least work on python3 -- but obviously #66 would be even better. |
|
That function should not be encoding literals as |
virtuald
commented
Nov 30, 2014
|
So, I stand corrected. When I install protobuf properly, it installs/runs from trunk without any noticable problems now. Python 3.4.2 on OSX. Now someone just needs to push an updated package to pypi... :) It would be nice to get better python3 support in trunk to support the edge cases properly, as @tseaver mentions. |
|
@gpshead would you be fine with only supporting python 2.6+? Current readme.txt mentions 2.4. Single-source cross python support is, FTR, like 10x easier if you only support python 2.6+ and 3.3+. |
|
Absolutely, 2.6 is a good minimum. Anything older is obsolete (I consider 2.6 obsolete as well, but it is easy enough to support). One of the reasons we started with some files needing to be run through 2to3 is that we have a few internal things still running on the old App Engine 2.5 legacy runtime that needed proto2 code and using 2to3 made maintaining 2.5 compatibility easier. I believe we have dealt with those internally now but I need to double check. We should absolutely be able to make a single source 2.6, 2.7, >= 3.3+ compatible version in the future. |
|
FWIW, #164 modernizes the |
cloudkey
referenced this issue
Feb 4, 2015
Closed
FileDescriptorTables *** glibc detected *** double free or corruption (out) #194
xfxyjwf
added
the
obsolete
label
Dec 22, 2015
xfxyjwf
closed this
Dec 22, 2015
thanatos
commented
Jul 13, 2016
•
|
Why is this bug marked as Closed & obsolete? I'm currently trying to get a third-party package ( There's a package |
jleclanche
commented
Jul 13, 2016
|
@thanatos https://pypi.python.org/pypi/protobuf |
thanatos
commented
Jul 15, 2016
•
While technically true, my understanding is that the major number here is bumped because it isn't backwards-compatible with compiled protocol buffers from protobuf v2; empirically, this seems to be the case; e.g., ( |
|
On Fri, Jul 15, 2016 at 2:41 PM, Roy Wellington Ⅳ notifications@github.com
|
KJaunay commentedSep 2, 2014
I've run into a problem when using Python 3.4 and protobuf 2.6.0.
I get several errors including:
protobuf/python/google/protobuf/internal/decoder.py, line 167
_DecodeVarint = _VarintDecoder((1 << 64) - 1, long)
NameError: name 'long' is not defined