| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.905 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.905 |
| Problem: Python interface can produce error "vim.message' object has no |
| attribute 'isatty'". |
| Solution: Add dummy isatty(), readable(), etc. (closes #464) |
| Files: src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok, |
| src/testdir/test87.in, src/testdir/test87.ok |
| |
| |
| |
| |
| |
| *** 465,484 **** |
| } |
| |
| static PyObject * |
| ! OutputFlush(PyObject *self UNUSED) |
| { |
| /* do nothing */ |
| Py_INCREF(Py_None); |
| return Py_None; |
| } |
| |
| / |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| *** 1094,1101 **** |
| --- 1094,1113 ---- |
| ee('del sys.stdout.softspace') |
| number_test('sys.stdout.softspace = %s', unsigned=True) |
| number_test('sys.stderr.softspace = %s', unsigned=True) |
| + ee('assert sys.stdout.isatty()==False') |
| + ee('assert sys.stdout.seekable()==False') |
| + ee('sys.stdout.close()') |
| + ee('sys.stdout.flush()') |
| + ee('assert sys.stderr.isatty()==False') |
| + ee('assert sys.stderr.seekable()==False') |
| + ee('sys.stderr.close()') |
| + ee('sys.stderr.flush()') |
| ee('sys.stdout.attr = None') |
| cb.append(">> OutputWrite") |
| + ee('assert sys.stdout.writable()==True') |
| + ee('assert sys.stdout.readable()==False') |
| + ee('assert sys.stderr.writable()==True') |
| + ee('assert sys.stderr.readable()==False') |
| ee('sys.stdout.write(None)') |
| cb.append(">> OutputWriteLines") |
| ee('sys.stdout.writelines(None)') |
| |
| |
| |
| *** 447,453 **** |
| dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values |
| list:__dir__,__members__,extend,locked |
| function:__dir__,__members__,softspace |
| ! output:__dir__,__members__,flush,softspace,write,writelines |
| {} |
| {'a': 1} |
| {'a': 1} |
| --- 447,453 ---- |
| dictionary:__dir__,__members__,get,has_key,items,keys,locked,pop,popitem,scope,update,values |
| list:__dir__,__members__,extend,locked |
| function:__dir__,__members__,softspace |
| ! output:__dir__,__members__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines |
| {} |
| {'a': 1} |
| {'a': 1} |
| |
| *** 488,495 **** |
| --- 488,507 ---- |
| sys.stderr.softspace = None:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',) |
| sys.stderr.softspace = -1:ValueError:('number must be greater or equal to zero',) |
| <<< Finished |
| + assert sys.stdout.isatty()==False:NOT FAILED |
| + assert sys.stdout.seekable()==False:NOT FAILED |
| + sys.stdout.close():NOT FAILED |
| + sys.stdout.flush():NOT FAILED |
| + assert sys.stderr.isatty()==False:NOT FAILED |
| + assert sys.stderr.seekable()==False:NOT FAILED |
| + sys.stderr.close():NOT FAILED |
| + sys.stderr.flush():NOT FAILED |
| sys.stdout.attr = None:AttributeError:('invalid attribute: attr',) |
| >> OutputWrite |
| + assert sys.stdout.writable()==True:NOT FAILED |
| + assert sys.stdout.readable()==False:NOT FAILED |
| + assert sys.stderr.writable()==True:NOT FAILED |
| + assert sys.stderr.readable()==False:NOT FAILED |
| sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',) |
| >> OutputWriteLines |
| sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",) |
| |
| |
| |
| *** 1071,1078 **** |
| --- 1071,1090 ---- |
| ee('del sys.stdout.softspace') |
| number_test('sys.stdout.softspace = %s', unsigned=True) |
| number_test('sys.stderr.softspace = %s', unsigned=True) |
| + ee('assert sys.stdout.isatty()==False') |
| + ee('assert sys.stdout.seekable()==False') |
| + ee('sys.stdout.close()') |
| + ee('sys.stdout.flush()') |
| + ee('assert sys.stderr.isatty()==False') |
| + ee('assert sys.stderr.seekable()==False') |
| + ee('sys.stderr.close()') |
| + ee('sys.stderr.flush()') |
| ee('sys.stdout.attr = None') |
| cb.append(">> OutputWrite") |
| + ee('assert sys.stdout.writable()==True') |
| + ee('assert sys.stdout.readable()==False') |
| + ee('assert sys.stderr.writable()==True') |
| + ee('assert sys.stderr.readable()==False') |
| ee('sys.stdout.write(None)') |
| cb.append(">> OutputWriteLines") |
| ee('sys.stdout.writelines(None)') |
| |
| |
| |
| *** 447,453 **** |
| dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values |
| list:__dir__,extend,locked |
| function:__dir__,softspace |
| ! output:__dir__,flush,softspace,write,writelines |
| {} |
| {'a': 1} |
| {'a': 1} |
| --- 447,453 ---- |
| dictionary:__dir__,get,has_key,items,keys,locked,pop,popitem,scope,update,values |
| list:__dir__,extend,locked |
| function:__dir__,softspace |
| ! output:__dir__,close,flush,isatty,readable,seekable,softspace,writable,write,writelines |
| {} |
| {'a': 1} |
| {'a': 1} |
| |
| *** 488,495 **** |
| --- 488,507 ---- |
| sys.stderr.softspace = None:(<class 'TypeError'>, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) |
| sys.stderr.softspace = -1:(<class 'ValueError'>, ValueError('number must be greater or equal to zero',)) |
| <<< Finished |
| + assert sys.stdout.isatty()==False:NOT FAILED |
| + assert sys.stdout.seekable()==False:NOT FAILED |
| + sys.stdout.close():NOT FAILED |
| + sys.stdout.flush():NOT FAILED |
| + assert sys.stderr.isatty()==False:NOT FAILED |
| + assert sys.stderr.seekable()==False:NOT FAILED |
| + sys.stderr.close():NOT FAILED |
| + sys.stderr.flush():NOT FAILED |
| sys.stdout.attr = None:(<class 'AttributeError'>, AttributeError('invalid attribute: attr',)) |
| >> OutputWrite |
| + assert sys.stdout.writable()==True:NOT FAILED |
| + assert sys.stdout.readable()==False:NOT FAILED |
| + assert sys.stderr.writable()==True:NOT FAILED |
| + assert sys.stderr.readable()==False:NOT FAILED |
| sys.stdout.write(None):(<class 'TypeError'>, TypeError("Can't convert 'NoneType' object to str implicitly",)) |
| >> OutputWriteLines |
| sys.stdout.writelines(None):(<class 'TypeError'>, TypeError("'NoneType' object is not iterable",)) |
| |
| |
| |
| *** 743,744 **** |
| --- 743,746 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 905, |
| /**/ |
| |
| -- |
| hundred-and-one symptoms of being an internet addict: |
| 78. You find yourself dialing IP numbers on the phone. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |