|
Karsten Hopp |
b6734f |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
b6734f |
Subject: Patch 7.3.1057
|
|
Karsten Hopp |
b6734f |
Fcc: outbox
|
|
Karsten Hopp |
b6734f |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
b6734f |
Mime-Version: 1.0
|
|
Karsten Hopp |
b6734f |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
b6734f |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
b6734f |
------------
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
Patch 7.3.1057
|
|
Karsten Hopp |
b6734f |
Problem: Python: not enough compatibilty.
|
|
Karsten Hopp |
b6734f |
Solution: Python patch 16: Make OutputWritelines support any sequence object
|
|
Karsten Hopp |
b6734f |
(ZyX) Note: tests fail
|
|
Karsten Hopp |
b6734f |
Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok,
|
|
Karsten Hopp |
b6734f |
src/testdir/test87.in, src/testdir/test87.ok
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
*** ../vim-7.3.1056/src/if_py_both.h 2013-05-30 12:14:44.000000000 +0200
|
|
Karsten Hopp |
b6734f |
--- src/if_py_both.h 2013-05-30 12:18:09.000000000 +0200
|
|
Karsten Hopp |
b6734f |
***************
|
|
Karsten Hopp |
b6734f |
*** 312,347 ****
|
|
Karsten Hopp |
b6734f |
static PyObject *
|
|
Karsten Hopp |
b6734f |
OutputWritelines(OutputObject *self, PyObject *args)
|
|
Karsten Hopp |
b6734f |
{
|
|
Karsten Hopp |
b6734f |
! PyInt n;
|
|
Karsten Hopp |
b6734f |
! PyInt i;
|
|
Karsten Hopp |
b6734f |
! PyObject *list;
|
|
Karsten Hopp |
b6734f |
int error = self->error;
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! if (!PyArg_ParseTuple(args, "O", &list))
|
|
Karsten Hopp |
b6734f |
return NULL;
|
|
Karsten Hopp |
b6734f |
- Py_INCREF(list);
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! if (!PyList_Check(list))
|
|
Karsten Hopp |
b6734f |
! {
|
|
Karsten Hopp |
b6734f |
! PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
|
|
Karsten Hopp |
b6734f |
! Py_DECREF(list);
|
|
Karsten Hopp |
b6734f |
return NULL;
|
|
Karsten Hopp |
b6734f |
- }
|
|
Karsten Hopp |
b6734f |
-
|
|
Karsten Hopp |
b6734f |
- n = PyList_Size(list);
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! for (i = 0; i < n; ++i)
|
|
Karsten Hopp |
b6734f |
{
|
|
Karsten Hopp |
b6734f |
- PyObject *line = PyList_GetItem(list, i);
|
|
Karsten Hopp |
b6734f |
char *str = NULL;
|
|
Karsten Hopp |
b6734f |
PyInt len;
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! if (!PyArg_Parse(line, "et#", ENC_OPT, &str, &len))
|
|
Karsten Hopp |
b6734f |
{
|
|
Karsten Hopp |
b6734f |
PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
|
|
Karsten Hopp |
b6734f |
! Py_DECREF(list);
|
|
Karsten Hopp |
b6734f |
return NULL;
|
|
Karsten Hopp |
b6734f |
}
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
Py_BEGIN_ALLOW_THREADS
|
|
Karsten Hopp |
b6734f |
Python_Lock_Vim();
|
|
Karsten Hopp |
b6734f |
--- 312,341 ----
|
|
Karsten Hopp |
b6734f |
static PyObject *
|
|
Karsten Hopp |
b6734f |
OutputWritelines(OutputObject *self, PyObject *args)
|
|
Karsten Hopp |
b6734f |
{
|
|
Karsten Hopp |
b6734f |
! PyObject *seq;
|
|
Karsten Hopp |
b6734f |
! PyObject *iterator;
|
|
Karsten Hopp |
b6734f |
! PyObject *item;
|
|
Karsten Hopp |
b6734f |
int error = self->error;
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! if (!PyArg_ParseTuple(args, "O", &seq))
|
|
Karsten Hopp |
b6734f |
return NULL;
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! if (!(iterator = PyObject_GetIter(seq)))
|
|
Karsten Hopp |
b6734f |
return NULL;
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! while ((item = PyIter_Next(iterator)))
|
|
Karsten Hopp |
b6734f |
{
|
|
Karsten Hopp |
b6734f |
char *str = NULL;
|
|
Karsten Hopp |
b6734f |
PyInt len;
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! if (!PyArg_Parse(item, "et#", ENC_OPT, &str, &len))
|
|
Karsten Hopp |
b6734f |
{
|
|
Karsten Hopp |
b6734f |
PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings"));
|
|
Karsten Hopp |
b6734f |
! Py_DECREF(iterator);
|
|
Karsten Hopp |
b6734f |
! Py_DECREF(item);
|
|
Karsten Hopp |
b6734f |
return NULL;
|
|
Karsten Hopp |
b6734f |
}
|
|
Karsten Hopp |
b6734f |
+ Py_DECREF(item);
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
Py_BEGIN_ALLOW_THREADS
|
|
Karsten Hopp |
b6734f |
Python_Lock_Vim();
|
|
Karsten Hopp |
b6734f |
***************
|
|
Karsten Hopp |
b6734f |
*** 351,357 ****
|
|
Karsten Hopp |
b6734f |
PyMem_Free(str);
|
|
Karsten Hopp |
b6734f |
}
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! Py_DECREF(list);
|
|
Karsten Hopp |
b6734f |
Py_INCREF(Py_None);
|
|
Karsten Hopp |
b6734f |
return Py_None;
|
|
Karsten Hopp |
b6734f |
}
|
|
Karsten Hopp |
b6734f |
--- 345,356 ----
|
|
Karsten Hopp |
b6734f |
PyMem_Free(str);
|
|
Karsten Hopp |
b6734f |
}
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
! Py_DECREF(iterator);
|
|
Karsten Hopp |
b6734f |
!
|
|
Karsten Hopp |
b6734f |
! /* Iterator may have finished due to an exception */
|
|
Karsten Hopp |
b6734f |
! if (PyErr_Occurred())
|
|
Karsten Hopp |
b6734f |
! return NULL;
|
|
Karsten Hopp |
b6734f |
!
|
|
Karsten Hopp |
b6734f |
Py_INCREF(Py_None);
|
|
Karsten Hopp |
b6734f |
return Py_None;
|
|
Karsten Hopp |
b6734f |
}
|
|
Karsten Hopp |
b6734f |
*** ../vim-7.3.1056/src/testdir/test86.in 2013-05-29 22:36:06.000000000 +0200
|
|
Karsten Hopp |
b6734f |
--- src/testdir/test86.in 2013-05-30 12:18:09.000000000 +0200
|
|
Karsten Hopp |
b6734f |
***************
|
|
Karsten Hopp |
b6734f |
*** 709,714 ****
|
|
Karsten Hopp |
b6734f |
--- 709,724 ----
|
|
Karsten Hopp |
b6734f |
del o
|
|
Karsten Hopp |
b6734f |
EOF
|
|
Karsten Hopp |
b6734f |
:"
|
|
Karsten Hopp |
b6734f |
+ :"
|
|
Karsten Hopp |
b6734f |
+ :" Test stdout/stderr
|
|
Karsten Hopp |
b6734f |
+ :redir => messages
|
|
Karsten Hopp |
b6734f |
+ :py sys.stdout.write('abc') ; sys.stdout.write('def')
|
|
Karsten Hopp |
b6734f |
+ :py sys.stderr.write('abc') ; sys.stderr.write('def')
|
|
Karsten Hopp |
b6734f |
+ :py sys.stdout.writelines(iter('abc'))
|
|
Karsten Hopp |
b6734f |
+ :py sys.stderr.writelines(iter('abc'))
|
|
Karsten Hopp |
b6734f |
+ :redir END
|
|
Karsten Hopp |
b6734f |
+ :$put =string(substitute(messages, '\d\+', '', 'g'))
|
|
Karsten Hopp |
b6734f |
+ :"
|
|
Karsten Hopp |
b6734f |
:" Test exceptions
|
|
Karsten Hopp |
b6734f |
:fun Exe(e)
|
|
Karsten Hopp |
b6734f |
: execute a:e
|
|
Karsten Hopp |
b6734f |
*** ../vim-7.3.1056/src/testdir/test86.ok 2013-05-30 11:43:11.000000000 +0200
|
|
Karsten Hopp |
b6734f |
--- src/testdir/test86.ok 2013-05-30 12:18:09.000000000 +0200
|
|
Karsten Hopp |
b6734f |
***************
|
|
Karsten Hopp |
b6734f |
*** 391,396 ****
|
|
Karsten Hopp |
b6734f |
--- 391,403 ----
|
|
Karsten Hopp |
b6734f |
list:__dir__,__members__,extend,locked
|
|
Karsten Hopp |
b6734f |
function:__call__,__dir__,__members__,softspace
|
|
Karsten Hopp |
b6734f |
output:__dir__,__members__,flush,softspace,write,writelines
|
|
Karsten Hopp |
b6734f |
+ '
|
|
Karsten Hopp |
b6734f |
+ abcdef
|
|
Karsten Hopp |
b6734f |
+ line :
|
|
Karsten Hopp |
b6734f |
+ abcdef
|
|
Karsten Hopp |
b6734f |
+ abc
|
|
Karsten Hopp |
b6734f |
+ line :
|
|
Karsten Hopp |
b6734f |
+ abc'
|
|
Karsten Hopp |
b6734f |
(<class 'vim.error'>, error('abc',))
|
|
Karsten Hopp |
b6734f |
(<class 'vim.error'>, error('def',))
|
|
Karsten Hopp |
b6734f |
(<class 'vim.error'>, error('ghi',))
|
|
Karsten Hopp |
b6734f |
*** ../vim-7.3.1056/src/testdir/test87.in 2013-05-29 22:36:06.000000000 +0200
|
|
Karsten Hopp |
b6734f |
--- src/testdir/test87.in 2013-05-30 12:18:09.000000000 +0200
|
|
Karsten Hopp |
b6734f |
***************
|
|
Karsten Hopp |
b6734f |
*** 687,692 ****
|
|
Karsten Hopp |
b6734f |
--- 687,702 ----
|
|
Karsten Hopp |
b6734f |
del o
|
|
Karsten Hopp |
b6734f |
EOF
|
|
Karsten Hopp |
b6734f |
:"
|
|
Karsten Hopp |
b6734f |
+ :"
|
|
Karsten Hopp |
b6734f |
+ :" Test stdout/stderr
|
|
Karsten Hopp |
b6734f |
+ :redir => messages
|
|
Karsten Hopp |
b6734f |
+ :py sys.stdout.write('abc') ; sys.stdout.write('def')
|
|
Karsten Hopp |
b6734f |
+ :py sys.stderr.write('abc') ; sys.stderr.write('def')
|
|
Karsten Hopp |
b6734f |
+ :py sys.stdout.writelines(iter('abc'))
|
|
Karsten Hopp |
b6734f |
+ :py sys.stderr.writelines(iter('abc'))
|
|
Karsten Hopp |
b6734f |
+ :redir END
|
|
Karsten Hopp |
b6734f |
+ :$put =string(substitute(messages, '\d\+', '', 'g'))
|
|
Karsten Hopp |
b6734f |
+ :"
|
|
Karsten Hopp |
b6734f |
:" Test exceptions
|
|
Karsten Hopp |
b6734f |
:fun Exe(e)
|
|
Karsten Hopp |
b6734f |
: execute a:e
|
|
Karsten Hopp |
b6734f |
*** ../vim-7.3.1056/src/testdir/test87.ok 2013-05-30 11:43:11.000000000 +0200
|
|
Karsten Hopp |
b6734f |
--- src/testdir/test87.ok 2013-05-30 12:18:09.000000000 +0200
|
|
Karsten Hopp |
b6734f |
***************
|
|
Karsten Hopp |
b6734f |
*** 380,385 ****
|
|
Karsten Hopp |
b6734f |
--- 380,392 ----
|
|
Karsten Hopp |
b6734f |
list:__dir__,extend,locked
|
|
Karsten Hopp |
b6734f |
function:__call__,__dir__,softspace
|
|
Karsten Hopp |
b6734f |
output:__dir__,flush,softspace,write,writelines
|
|
Karsten Hopp |
b6734f |
+ '
|
|
Karsten Hopp |
b6734f |
+ abcdef
|
|
Karsten Hopp |
b6734f |
+ line :
|
|
Karsten Hopp |
b6734f |
+ abcdef
|
|
Karsten Hopp |
b6734f |
+ abc
|
|
Karsten Hopp |
b6734f |
+ line :
|
|
Karsten Hopp |
b6734f |
+ abc'
|
|
Karsten Hopp |
b6734f |
(<class 'vim.error'>, error('abc',))
|
|
Karsten Hopp |
b6734f |
(<class 'vim.error'>, error('def',))
|
|
Karsten Hopp |
b6734f |
(<class 'vim.error'>, error('ghi',))
|
|
Karsten Hopp |
b6734f |
*** ../vim-7.3.1056/src/version.c 2013-05-30 12:14:44.000000000 +0200
|
|
Karsten Hopp |
b6734f |
--- src/version.c 2013-05-30 12:20:02.000000000 +0200
|
|
Karsten Hopp |
b6734f |
***************
|
|
Karsten Hopp |
b6734f |
*** 730,731 ****
|
|
Karsten Hopp |
b6734f |
--- 730,733 ----
|
|
Karsten Hopp |
b6734f |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
b6734f |
+ /**/
|
|
Karsten Hopp |
b6734f |
+ 1057,
|
|
Karsten Hopp |
b6734f |
/**/
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
--
|
|
Karsten Hopp |
b6734f |
I have a drinking problem -- I don't have a drink!
|
|
Karsten Hopp |
b6734f |
|
|
Karsten Hopp |
b6734f |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
b6734f |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
b6734f |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
b6734f |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|