|
Karsten Hopp |
16e164 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
16e164 |
Subject: Patch 7.4.905
|
|
Karsten Hopp |
16e164 |
Fcc: outbox
|
|
Karsten Hopp |
16e164 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
16e164 |
Mime-Version: 1.0
|
|
Karsten Hopp |
16e164 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
16e164 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
16e164 |
------------
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
Patch 7.4.905
|
|
Karsten Hopp |
16e164 |
Problem: Python interface can produce error "vim.message' object has no
|
|
Karsten Hopp |
16e164 |
attribute 'isatty'".
|
|
Karsten Hopp |
16e164 |
Solution: Add dummy isatty(), readable(), etc. (closes #464)
|
|
Karsten Hopp |
16e164 |
Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok,
|
|
Karsten Hopp |
16e164 |
src/testdir/test87.in, src/testdir/test87.ok
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
*** ../vim-7.4.904/src/if_py_both.h 2015-02-10 18:41:53.006111926 +0100
|
|
Karsten Hopp |
16e164 |
--- src/if_py_both.h 2015-11-02 13:21:24.911033469 +0100
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 465,484 ****
|
|
Karsten Hopp |
16e164 |
}
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
static PyObject *
|
|
Karsten Hopp |
16e164 |
! OutputFlush(PyObject *self UNUSED)
|
|
Karsten Hopp |
16e164 |
{
|
|
Karsten Hopp |
16e164 |
/* do nothing */
|
|
Karsten Hopp |
16e164 |
Py_INCREF(Py_None);
|
|
Karsten Hopp |
16e164 |
return Py_None;
|
|
Karsten Hopp |
16e164 |
}
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
/***************/
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
static struct PyMethodDef OutputMethods[] = {
|
|
Karsten Hopp |
16e164 |
/* name, function, calling, doc */
|
|
Karsten Hopp |
16e164 |
{"write", (PyCFunction)OutputWrite, METH_O, ""},
|
|
Karsten Hopp |
16e164 |
{"writelines", (PyCFunction)OutputWritelines, METH_O, ""},
|
|
Karsten Hopp |
16e164 |
! {"flush", (PyCFunction)OutputFlush, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
{"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
{ NULL, NULL, 0, NULL}
|
|
Karsten Hopp |
16e164 |
};
|
|
Karsten Hopp |
16e164 |
--- 465,505 ----
|
|
Karsten Hopp |
16e164 |
}
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
static PyObject *
|
|
Karsten Hopp |
16e164 |
! AlwaysNone(PyObject *self UNUSED)
|
|
Karsten Hopp |
16e164 |
{
|
|
Karsten Hopp |
16e164 |
/* do nothing */
|
|
Karsten Hopp |
16e164 |
Py_INCREF(Py_None);
|
|
Karsten Hopp |
16e164 |
return Py_None;
|
|
Karsten Hopp |
16e164 |
}
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
+ static PyObject *
|
|
Karsten Hopp |
16e164 |
+ AlwaysFalse(PyObject *self UNUSED)
|
|
Karsten Hopp |
16e164 |
+ {
|
|
Karsten Hopp |
16e164 |
+ /* do nothing */
|
|
Karsten Hopp |
16e164 |
+ Py_INCREF(Py_False);
|
|
Karsten Hopp |
16e164 |
+ return Py_False;
|
|
Karsten Hopp |
16e164 |
+ }
|
|
Karsten Hopp |
16e164 |
+
|
|
Karsten Hopp |
16e164 |
+ static PyObject *
|
|
Karsten Hopp |
16e164 |
+ AlwaysTrue(PyObject *self UNUSED)
|
|
Karsten Hopp |
16e164 |
+ {
|
|
Karsten Hopp |
16e164 |
+ /* do nothing */
|
|
Karsten Hopp |
16e164 |
+ Py_INCREF(Py_True);
|
|
Karsten Hopp |
16e164 |
+ return Py_True;
|
|
Karsten Hopp |
16e164 |
+ }
|
|
Karsten Hopp |
16e164 |
+
|
|
Karsten Hopp |
16e164 |
/***************/
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
static struct PyMethodDef OutputMethods[] = {
|
|
Karsten Hopp |
16e164 |
/* name, function, calling, doc */
|
|
Karsten Hopp |
16e164 |
{"write", (PyCFunction)OutputWrite, METH_O, ""},
|
|
Karsten Hopp |
16e164 |
{"writelines", (PyCFunction)OutputWritelines, METH_O, ""},
|
|
Karsten Hopp |
16e164 |
! {"flush", (PyCFunction)AlwaysNone, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
! {"close", (PyCFunction)AlwaysNone, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
! {"isatty", (PyCFunction)AlwaysFalse, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
! {"readable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
! {"seekable", (PyCFunction)AlwaysFalse, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
! {"writable", (PyCFunction)AlwaysTrue, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
{"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""},
|
|
Karsten Hopp |
16e164 |
{ NULL, NULL, 0, NULL}
|
|
Karsten Hopp |
16e164 |
};
|
|
Karsten Hopp |
16e164 |
*** ../vim-7.4.904/src/testdir/test86.in 2014-09-29 18:08:54.587952270 +0200
|
|
Karsten Hopp |
16e164 |
--- src/testdir/test86.in 2015-11-02 13:19:04.276680955 +0100
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 1094,1101 ****
|
|
Karsten Hopp |
16e164 |
--- 1094,1113 ----
|
|
Karsten Hopp |
16e164 |
ee('del sys.stdout.softspace')
|
|
Karsten Hopp |
16e164 |
number_test('sys.stdout.softspace = %s', unsigned=True)
|
|
Karsten Hopp |
16e164 |
number_test('sys.stderr.softspace = %s', unsigned=True)
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.isatty()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.seekable()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stdout.close()')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stdout.flush()')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.isatty()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.seekable()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stderr.close()')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stderr.flush()')
|
|
Karsten Hopp |
16e164 |
ee('sys.stdout.attr = None')
|
|
Karsten Hopp |
16e164 |
cb.append(">> OutputWrite")
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.writable()==True')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.readable()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.writable()==True')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.readable()==False')
|
|
Karsten Hopp |
16e164 |
ee('sys.stdout.write(None)')
|
|
Karsten Hopp |
16e164 |
cb.append(">> OutputWriteLines")
|
|
Karsten Hopp |
16e164 |
ee('sys.stdout.writelines(None)')
|
|
Karsten Hopp |
16e164 |
*** ../vim-7.4.904/src/testdir/test86.ok 2014-03-12 15:26:36.428714415 +0100
|
|
Karsten Hopp |
16e164 |
--- src/testdir/test86.ok 2015-11-02 13:19:04.280680909 +0100
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 447,453 ****
|
|
Karsten Hopp |
16e164 |
dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
|
|
Karsten Hopp |
16e164 |
list:__dir__,__members__,extend,locked
|
|
Karsten Hopp |
16e164 |
function:__dir__,__members__,softspace
|
|
Karsten Hopp |
16e164 |
! output:__dir__,__members__,flush,softspace,write,writelines
|
|
Karsten Hopp |
16e164 |
{}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
--- 447,453 ----
|
|
Karsten Hopp |
16e164 |
dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
|
|
Karsten Hopp |
16e164 |
list:__dir__,__members__,extend,locked
|
|
Karsten Hopp |
16e164 |
function:__dir__,__members__,softspace
|
|
Karsten Hopp |
16e164 |
! output:__dir__,__members__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines
|
|
Karsten Hopp |
16e164 |
{}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 488,495 ****
|
|
Karsten Hopp |
16e164 |
--- 488,507 ----
|
|
Karsten Hopp |
16e164 |
sys.stderr.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',)
|
|
Karsten Hopp |
16e164 |
sys.stderr.softspace = -1:ValueError:('number must be greater or equal to zero',)
|
|
Karsten Hopp |
16e164 |
<<< Finished
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.isatty()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.seekable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stdout.close():NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stdout.flush():NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.isatty()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.seekable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stderr.close():NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stderr.flush():NOT FAILED
|
|
Karsten Hopp |
16e164 |
sys.stdout.attr = None:AttributeError:('invalid attribute: attr',)
|
|
Karsten Hopp |
16e164 |
>> OutputWrite
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.writable()==True:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.readable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.writable()==True:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.readable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',)
|
|
Karsten Hopp |
16e164 |
>> OutputWriteLines
|
|
Karsten Hopp |
16e164 |
sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",)
|
|
Karsten Hopp |
16e164 |
*** ../vim-7.4.904/src/testdir/test87.in 2014-09-29 18:08:54.591952271 +0200
|
|
Karsten Hopp |
16e164 |
--- src/testdir/test87.in 2015-11-02 13:19:04.280680909 +0100
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 1071,1078 ****
|
|
Karsten Hopp |
16e164 |
--- 1071,1090 ----
|
|
Karsten Hopp |
16e164 |
ee('del sys.stdout.softspace')
|
|
Karsten Hopp |
16e164 |
number_test('sys.stdout.softspace = %s', unsigned=True)
|
|
Karsten Hopp |
16e164 |
number_test('sys.stderr.softspace = %s', unsigned=True)
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.isatty()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.seekable()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stdout.close()')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stdout.flush()')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.isatty()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.seekable()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stderr.close()')
|
|
Karsten Hopp |
16e164 |
+ ee('sys.stderr.flush()')
|
|
Karsten Hopp |
16e164 |
ee('sys.stdout.attr = None')
|
|
Karsten Hopp |
16e164 |
cb.append(">> OutputWrite")
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.writable()==True')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stdout.readable()==False')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.writable()==True')
|
|
Karsten Hopp |
16e164 |
+ ee('assert sys.stderr.readable()==False')
|
|
Karsten Hopp |
16e164 |
ee('sys.stdout.write(None)')
|
|
Karsten Hopp |
16e164 |
cb.append(">> OutputWriteLines")
|
|
Karsten Hopp |
16e164 |
ee('sys.stdout.writelines(None)')
|
|
Karsten Hopp |
16e164 |
*** ../vim-7.4.904/src/testdir/test87.ok 2014-03-12 15:26:36.432714415 +0100
|
|
Karsten Hopp |
16e164 |
--- src/testdir/test87.ok 2015-11-02 13:19:04.280680909 +0100
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 447,453 ****
|
|
Karsten Hopp |
16e164 |
dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
|
|
Karsten Hopp |
16e164 |
list:__dir__,extend,locked
|
|
Karsten Hopp |
16e164 |
function:__dir__,softspace
|
|
Karsten Hopp |
16e164 |
! output:__dir__,flush,softspace,write,writelines
|
|
Karsten Hopp |
16e164 |
{}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
--- 447,453 ----
|
|
Karsten Hopp |
16e164 |
dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values
|
|
Karsten Hopp |
16e164 |
list:__dir__,extend,locked
|
|
Karsten Hopp |
16e164 |
function:__dir__,softspace
|
|
Karsten Hopp |
16e164 |
! output:__dir__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines
|
|
Karsten Hopp |
16e164 |
{}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
{'a': 1}
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 488,495 ****
|
|
Karsten Hopp |
16e164 |
--- 488,507 ----
|
|
Karsten Hopp |
16e164 |
sys.stderr.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',))
|
|
Karsten Hopp |
16e164 |
sys.stderr.softspace = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',))
|
|
Karsten Hopp |
16e164 |
<<< Finished
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.isatty()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.seekable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stdout.close():NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stdout.flush():NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.isatty()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.seekable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stderr.close():NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ sys.stderr.flush():NOT FAILED
|
|
Karsten Hopp |
16e164 |
sys.stdout.attr = None:(<class 'AttributeError'>, AttributeError('invalid attribute: attr',))
|
|
Karsten Hopp |
16e164 |
>> OutputWrite
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.writable()==True:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stdout.readable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.writable()==True:NOT FAILED
|
|
Karsten Hopp |
16e164 |
+ assert sys.stderr.readable()==False:NOT FAILED
|
|
Karsten Hopp |
16e164 |
sys.stdout.write(None):(<class 'TypeError'>, TypeError("Can't convert 'NoneType' object to str implicitly",))
|
|
Karsten Hopp |
16e164 |
>> OutputWriteLines
|
|
Karsten Hopp |
16e164 |
sys.stdout.writelines(None):(<class 'TypeError'>, TypeError("'NoneType' object is not iterable",))
|
|
Karsten Hopp |
16e164 |
*** ../vim-7.4.904/src/version.c 2015-11-02 12:50:49.760534351 +0100
|
|
Karsten Hopp |
16e164 |
--- src/version.c 2015-11-02 13:27:03.923061723 +0100
|
|
Karsten Hopp |
16e164 |
***************
|
|
Karsten Hopp |
16e164 |
*** 743,744 ****
|
|
Karsten Hopp |
16e164 |
--- 743,746 ----
|
|
Karsten Hopp |
16e164 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
16e164 |
+ /**/
|
|
Karsten Hopp |
16e164 |
+ 905,
|
|
Karsten Hopp |
16e164 |
/**/
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
--
|
|
Karsten Hopp |
16e164 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
16e164 |
78. You find yourself dialing IP numbers on the phone.
|
|
Karsten Hopp |
16e164 |
|
|
Karsten Hopp |
16e164 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
16e164 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
16e164 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
16e164 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|