0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.3.910

Problem:    Python code in #ifdef branches with only minor differences.
Solution:   Merge the #ifdef branches. (ZyX)
This commit is contained in:
Bram Moolenaar
2013-04-24 13:47:45 +02:00
parent 4d1da49cfe
commit 335e0b6974
3 changed files with 4 additions and 39 deletions

View File

@@ -2853,7 +2853,6 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
tv->v_type = VAR_FUNC; tv->v_type = VAR_FUNC;
func_ref(tv->vval.v_string); func_ref(tv->vval.v_string);
} }
#if PY_MAJOR_VERSION >= 3
else if (PyBytes_Check(obj)) else if (PyBytes_Check(obj))
{ {
char_u *result; char_u *result;
@@ -2868,30 +2867,6 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
tv->v_type = VAR_STRING; 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)) else if (PyUnicode_Check(obj))
{ {
PyObject *bytes; PyObject *bytes;
@@ -2915,20 +2890,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookupDict)
tv->v_type = VAR_STRING; tv->v_type = VAR_STRING;
} }
else if (PyString_Check(obj)) #if PY_MAJOR_VERSION < 3
{
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;
}
else if (PyInt_Check(obj)) else if (PyInt_Check(obj))
{ {
tv->v_type = VAR_NUMBER; tv->v_type = VAR_NUMBER;

View File

@@ -59,6 +59,7 @@
static void init_structs(void); static void init_structs(void);
#define PyBytes_FromString PyString_FromString #define PyBytes_FromString PyString_FromString
#define PyBytes_Check PyString_Check
/* No-op conversion functions, use with care! */ /* No-op conversion functions, use with care! */
#define PyString_AsBytes(obj) (obj) #define PyString_AsBytes(obj) (obj)

View File

@@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
910,
/**/ /**/
909, 909,
/**/ /**/