-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
roslz4: Improve py3k compatibility. #563
Conversation
Use explicit relative import, py3.3 and 3.4 refuse to import roslz4 otherwise.
Can one of the admins verify this patch? |
Thanks, the modified import is indeed necessary. @bcharrow Could you look into making the shared library also importable with Python 3? |
Thanks for the fix! I'll take a look at improving Python 3 compatibility soon. |
Note: When I was talking about "very far from being sufficient for py3k support" I was talking about the whole ros_comm: I have like half the testsuite failing with it. |
The import fails for me due to a missing symbol:
@aballier Are you sure that you have setup the Python 3 environment correctly? Especially you either need a virtual env with all Python packages installed for Python 3 or the python3-* Debian packages (which are not side-by-side installable with the Python 2 ones). Most of ROS core should work perfectly fine nowadays - as well as most unit tests (with some issue left though). |
You're probably building with python2 headers: See https://github.com/ros/ros_comm/blob/indigo-devel/utilities/roslz4/src/_roslz4module.c#L411 ; that symbol is defined but under #if PY_MAJOR_VERSION >= 3 I'm not using debian nor virtualenv but gentoo where all sane python-x.y can be installed in parallel (if you think about it, this can quickly be a complete bloat but it is very useful for development and python porting); apart from setting python to the correct version, I also feed cmake with '-DPYTHON_EXECUTABLE="path to versionned python executable"' so maybe that's the reason it finds python2 headers for you. As for the tests, "half the testsuite" was a bit exagerated :) I had much more failures without the above patch, now it is down to 8/129 failures. It's possible I'm just frightened but that kind of failures might be hard to fix:
|
You are right, I didn't switch to a full Python 3 build. I guess this PR is good to be merged then. Most of the remaining Python 3 issues are related to ros/genpy#26. But we decided to not spend more time on looking into it for now. |
Test passed. |
roslz4: Improve py3k compatibility.
roslz4: Improve py3k compatibility.
Use explicit relative import, py3.3 and 3.4 refuse to import roslz4 otherwise.
This is trivial and backward compatible, but unfortunately very far from being sufficient for py3k support. I'm filling this to avoid letting it rot in my local tree.