]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.910 v7.3.910
authorBram Moolenaar <Bram@vim.org>
Wed, 24 Apr 2013 11:47:45 +0000 (13:47 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 24 Apr 2013 11:47:45 +0000 (13:47 +0200)
Problem:    Python code in #ifdef branches with only minor differences.
Solution:   Merge the #ifdef branches. (ZyX)

src/if_py_both.h
src/if_python.c
src/version.c

index c24e86334b29d9e39cbbc6a0ee70da6a6b7e4198..6e4f01af3bca2227ad65f4a4848f92c5d1e0ec94 100644 (file)
@@ -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;
@@ -2868,30 +2867,6 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
 
        tv->v_type = VAR_STRING;
     }
-    else if (PyUnicode_Check(obj))
-    {
-       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;
@@ -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;
index b13e73942315f6537e434813080548c860f566d2..547df3accf24f0c64725da25c7d3bfe191c23500 100644 (file)
@@ -59,6 +59,7 @@
 static void init_structs(void);
 
 #define PyBytes_FromString PyString_FromString
+#define PyBytes_Check PyString_Check
 
 /* No-op conversion functions, use with care! */
 #define PyString_AsBytes(obj) (obj)
index 7a11a8fbc3e1e67d0e12631c65412f553d1aec0e..95cd857563d91794e91bc18ff366688f236e74a8 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    910,
 /**/
     909,
 /**/