|
Karsten Hopp |
6ae0d6 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
6ae0d6 |
Subject: Patch 7.3.910
|
|
Karsten Hopp |
6ae0d6 |
Fcc: outbox
|
|
Karsten Hopp |
6ae0d6 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
6ae0d6 |
Mime-Version: 1.0
|
|
Karsten Hopp |
6ae0d6 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
6ae0d6 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
6ae0d6 |
------------
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
Patch 7.3.910
|
|
Karsten Hopp |
6ae0d6 |
Problem: Python code in #ifdef branches with only minor differences.
|
|
Karsten Hopp |
6ae0d6 |
Solution: Merge the #ifdef branches. (ZyX)
|
|
Karsten Hopp |
6ae0d6 |
Files: src/if_py_both.h, src/if_python.c
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
*** ../vim-7.3.909/src/if_py_both.h 2013-04-24 13:39:11.000000000 +0200
|
|
Karsten Hopp |
6ae0d6 |
--- src/if_py_both.h 2013-04-24 13:42:30.000000000 +0200
|
|
Karsten Hopp |
6ae0d6 |
***************
|
|
Karsten Hopp |
6ae0d6 |
*** 2853,2859 ****
|
|
Karsten Hopp |
6ae0d6 |
tv->v_type = VAR_FUNC;
|
|
Karsten Hopp |
6ae0d6 |
func_ref(tv->vval.v_string);
|
|
Karsten Hopp |
6ae0d6 |
}
|
|
Karsten Hopp |
6ae0d6 |
- #if PY_MAJOR_VERSION >= 3
|
|
Karsten Hopp |
6ae0d6 |
else if (PyBytes_Check(obj))
|
|
Karsten Hopp |
6ae0d6 |
{
|
|
Karsten Hopp |
6ae0d6 |
char_u *result;
|
|
Karsten Hopp |
6ae0d6 |
--- 2853,2858 ----
|
|
Karsten Hopp |
6ae0d6 |
***************
|
|
Karsten Hopp |
6ae0d6 |
*** 2873,2902 ****
|
|
Karsten Hopp |
6ae0d6 |
PyObject *bytes;
|
|
Karsten Hopp |
6ae0d6 |
char_u *result;
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
- bytes = PyString_AsBytes(obj);
|
|
Karsten Hopp |
6ae0d6 |
- if (bytes == NULL)
|
|
Karsten Hopp |
6ae0d6 |
- return -1;
|
|
Karsten Hopp |
6ae0d6 |
-
|
|
Karsten Hopp |
6ae0d6 |
- if(PyString_AsStringAndSize(bytes, (char **) &result, NULL) == -1)
|
|
Karsten Hopp |
6ae0d6 |
- return -1;
|
|
Karsten Hopp |
6ae0d6 |
- if (result == NULL)
|
|
Karsten Hopp |
6ae0d6 |
- return -1;
|
|
Karsten Hopp |
6ae0d6 |
-
|
|
Karsten Hopp |
6ae0d6 |
- if (set_string_copy(result, tv) == -1)
|
|
Karsten Hopp |
6ae0d6 |
- {
|
|
Karsten Hopp |
6ae0d6 |
- Py_XDECREF(bytes);
|
|
Karsten Hopp |
6ae0d6 |
- return -1;
|
|
Karsten Hopp |
6ae0d6 |
- }
|
|
Karsten Hopp |
6ae0d6 |
- Py_XDECREF(bytes);
|
|
Karsten Hopp |
6ae0d6 |
-
|
|
Karsten Hopp |
6ae0d6 |
- tv->v_type = VAR_STRING;
|
|
Karsten Hopp |
6ae0d6 |
- }
|
|
Karsten Hopp |
6ae0d6 |
- #else
|
|
Karsten Hopp |
6ae0d6 |
- else if (PyUnicode_Check(obj))
|
|
Karsten Hopp |
6ae0d6 |
- {
|
|
Karsten Hopp |
6ae0d6 |
- PyObject *bytes;
|
|
Karsten Hopp |
6ae0d6 |
- char_u *result;
|
|
Karsten Hopp |
6ae0d6 |
-
|
|
Karsten Hopp |
6ae0d6 |
bytes = PyUnicode_AsEncodedString(obj, (char *)ENC_OPT, NULL);
|
|
Karsten Hopp |
6ae0d6 |
if (bytes == NULL)
|
|
Karsten Hopp |
6ae0d6 |
return -1;
|
|
Karsten Hopp |
6ae0d6 |
--- 2872,2877 ----
|
|
Karsten Hopp |
6ae0d6 |
***************
|
|
Karsten Hopp |
6ae0d6 |
*** 2915,2934 ****
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
tv->v_type = VAR_STRING;
|
|
Karsten Hopp |
6ae0d6 |
}
|
|
Karsten Hopp |
6ae0d6 |
! else if (PyString_Check(obj))
|
|
Karsten Hopp |
6ae0d6 |
! {
|
|
Karsten Hopp |
6ae0d6 |
! char_u *result;
|
|
Karsten Hopp |
6ae0d6 |
!
|
|
Karsten Hopp |
6ae0d6 |
! if(PyString_AsStringAndSize(obj, (char **) &result, NULL) == -1)
|
|
Karsten Hopp |
6ae0d6 |
! return -1;
|
|
Karsten Hopp |
6ae0d6 |
! if (result == NULL)
|
|
Karsten Hopp |
6ae0d6 |
! return -1;
|
|
Karsten Hopp |
6ae0d6 |
!
|
|
Karsten Hopp |
6ae0d6 |
! if (set_string_copy(result, tv) == -1)
|
|
Karsten Hopp |
6ae0d6 |
! return -1;
|
|
Karsten Hopp |
6ae0d6 |
!
|
|
Karsten Hopp |
6ae0d6 |
! tv->v_type = VAR_STRING;
|
|
Karsten Hopp |
6ae0d6 |
! }
|
|
Karsten Hopp |
6ae0d6 |
else if (PyInt_Check(obj))
|
|
Karsten Hopp |
6ae0d6 |
{
|
|
Karsten Hopp |
6ae0d6 |
tv->v_type = VAR_NUMBER;
|
|
Karsten Hopp |
6ae0d6 |
--- 2890,2896 ----
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
tv->v_type = VAR_STRING;
|
|
Karsten Hopp |
6ae0d6 |
}
|
|
Karsten Hopp |
6ae0d6 |
! #if PY_MAJOR_VERSION < 3
|
|
Karsten Hopp |
6ae0d6 |
else if (PyInt_Check(obj))
|
|
Karsten Hopp |
6ae0d6 |
{
|
|
Karsten Hopp |
6ae0d6 |
tv->v_type = VAR_NUMBER;
|
|
Karsten Hopp |
6ae0d6 |
*** ../vim-7.3.909/src/if_python.c 2013-04-24 13:39:11.000000000 +0200
|
|
Karsten Hopp |
6ae0d6 |
--- src/if_python.c 2013-04-24 13:42:30.000000000 +0200
|
|
Karsten Hopp |
6ae0d6 |
***************
|
|
Karsten Hopp |
6ae0d6 |
*** 59,64 ****
|
|
Karsten Hopp |
6ae0d6 |
--- 59,65 ----
|
|
Karsten Hopp |
6ae0d6 |
static void init_structs(void);
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
#define PyBytes_FromString PyString_FromString
|
|
Karsten Hopp |
6ae0d6 |
+ #define PyBytes_Check PyString_Check
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
/* No-op conversion functions, use with care! */
|
|
Karsten Hopp |
6ae0d6 |
#define PyString_AsBytes(obj) (obj)
|
|
Karsten Hopp |
6ae0d6 |
*** ../vim-7.3.909/src/version.c 2013-04-24 13:39:11.000000000 +0200
|
|
Karsten Hopp |
6ae0d6 |
--- src/version.c 2013-04-24 13:43:51.000000000 +0200
|
|
Karsten Hopp |
6ae0d6 |
***************
|
|
Karsten Hopp |
6ae0d6 |
*** 730,731 ****
|
|
Karsten Hopp |
6ae0d6 |
--- 730,733 ----
|
|
Karsten Hopp |
6ae0d6 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
6ae0d6 |
+ /**/
|
|
Karsten Hopp |
6ae0d6 |
+ 910,
|
|
Karsten Hopp |
6ae0d6 |
/**/
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
--
|
|
Karsten Hopp |
6ae0d6 |
Your fault: core dumped
|
|
Karsten Hopp |
6ae0d6 |
|
|
Karsten Hopp |
6ae0d6 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
6ae0d6 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
6ae0d6 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
6ae0d6 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|