-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fix compilation error #49
Conversation
Fixes #48.
I also encountered this today, and unfortunately the Travis build fails on python 2. It seems like they may have changed the type with 3.7 |
Ah, didn’t check CI results 😕. I’m without computer access for a couple of weeks, anyone feel free to push fixes to this PR meanwhile. |
Turns out I forgot to remove the initial hacky cast solution in the PR. But keeping that (line 48) and removing the rest probably makes CI happy. The cast is probably required anyway to stay compatible with Python < 3.7. The return type of |
Can I push to your branch? Or could you give me access to your fork; I could take a stab at it. |
@maxnordlund Sure, did you try? Not sure how it works with permissions, some guy pushed to a PR of mine the other day without me giving explicit permissions. Pushed to my fork that is. |
I think that only works for members of the original repo, i.e. nixprime. |
@maxnordlund I’ve sent you a collaborator invite. |
Thank you, I've accepted and will try some stuff. If just the cast won't work, I'm going for the full blown PY_MAJOR_VERSION/PY_MINOR_VERSION conditional compilation changing the signature of PyVimString_AsStringAndSize for ≥ 3.7 |
Well, that went smoothly. Now it's ready I think, if @nixprime agrees. (Also you can just squash away my commit) |
@maxnordlund 🎉💪👍 |
src/python_extension.cc
Outdated
@@ -45,7 +45,7 @@ typedef std::unique_ptr<PyObject, PyObjectDeleter> PyObjPtr; | |||
inline bool PyVimString_AsStringAndSize(PyObject* obj, char** data, | |||
Py_ssize_t* size) { | |||
#if PY_MAJOR_VERSION >= 3 | |||
*data = PyUnicode_AsUTF8AndSize(obj, size); | |||
*data = (char*)PyUnicode_AsUTF8AndSize(obj, size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const_cast<char *>(PyUnicode_AsUTF8AndSize(obj, size))
would be more idiomatic for C++.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll change it.
@nixprime Ping. I have encountered the problem today.. |
This PR fixes the issue for me with nvim and python 3.7.0-3. Thanks @ptzz and @maxnordlund ! |
After manually patching the plugin according to nixprime/cpsm#49
Fixes #48.