summaryrefslogtreecommitdiff
path: root/src/if_py_both.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-04-24 13:47:45 +0200
committerBram Moolenaar <Bram@vim.org>2013-04-24 13:47:45 +0200
commit335e0b69744ededb907fb9167f72ac84e37e1304 (patch)
tree32bfacea7b64cb829c456f1ad1eebe4efbee985c /src/if_py_both.h
parent4d1da49cfe2528474dafb0535dd0cab19c3c3579 (diff)
downloadvim-git-335e0b69744ededb907fb9167f72ac84e37e1304.tar.gz
updated for version 7.3.910v7.3.910
Problem: Python code in #ifdef branches with only minor differences. Solution: Merge the #ifdef branches. (ZyX)
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r--src/if_py_both.h40
1 files changed, 1 insertions, 39 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index c24e86334..6e4f01af3 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -2853,7 +2853,6 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
tv->v_type = VAR_FUNC;
func_ref(tv->vval.v_string);
}
-#if PY_MAJOR_VERSION >= 3
else if (PyBytes_Check(obj))
{
char_u *result;
@@ -2873,30 +2872,6 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
PyObject *bytes;
char_u *result;
- bytes = PyString_AsBytes(obj);
- if (bytes == NULL)
- return -1;
-
- if(PyString_AsStringAndSize(bytes, (char **) &result, NULL) == -1)
- return -1;
- if (result == NULL)
- return -1;
-
- if (set_string_copy(result, tv) == -1)
- {
- Py_XDECREF(bytes);
- return -1;
- }
- Py_XDECREF(bytes);
-
- tv->v_type = VAR_STRING;
- }
-#else
- else if (PyUnicode_Check(obj))
- {
- PyObject *bytes;
- char_u *result;
-
bytes = PyUnicode_AsEncodedString(obj, (char *)ENC_OPT, NULL);
if (bytes == NULL)
return -1;
@@ -2915,20 +2890,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
tv->v_type = VAR_STRING;
}
- else if (PyString_Check(obj))
- {
- char_u *result;
-
- if(PyString_AsStringAndSize(obj, (char **) &result, NULL) == -1)
- return -1;
- if (result == NULL)
- return -1;
-
- if (set_string_copy(result, tv) == -1)
- return -1;
-
- tv->v_type = VAR_STRING;
- }
+#if PY_MAJOR_VERSION < 3
else if (PyInt_Check(obj))
{
tv->v_type = VAR_NUMBER;