Skip to content

Commit

Permalink
Fix compilation error
Browse files Browse the repository at this point in the history
Fixes #48.
  • Loading branch information
ptzz committed Jun 30, 2018
1 parent 8a4a0a0 commit 942d7ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/python_extension.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ typedef std::unique_ptr<PyObject, PyObjectDeleter> PyObjPtr;

// Wrappers around Python 2/3 string type distinctions.

inline bool PyVimString_AsStringAndSize(PyObject* obj, char** data,
inline bool PyVimString_AsStringAndSize(PyObject* obj, const char** data,
Py_ssize_t* size) {
#if PY_MAJOR_VERSION >= 3
*data = PyUnicode_AsUTF8AndSize(obj, size);
*data = (char*)PyUnicode_AsUTF8AndSize(obj, size);
return *data != nullptr;
#else
return PyString_AsStringAndSize(obj, data, size) >= 0;
Expand Down Expand Up @@ -106,7 +106,7 @@ class PyIterCtrlPMatchSource {
if (item_obj == nullptr) {
return false;
}
char* item_data;
const char* item_data;
Py_ssize_t item_size;
if (!PyVimString_AsStringAndSize(item_obj.get(), &item_data,
&item_size)) {
Expand Down Expand Up @@ -163,7 +163,7 @@ class PyListCtrlPMatchSource {
if (item_obj == nullptr) {
return false;
}
char* item_data;
const char* item_data;
Py_ssize_t item_size;
if (!PyVimString_AsStringAndSize(item_obj, &item_data, &item_size)) {
return false;
Expand Down

0 comments on commit 942d7ea

Please sign in to comment.