Mercurial > vim
comparison src/testdir/test87.in @ 4599:89bec74fd793 v7.3.1047
updated for version 7.3.1047
Problem: Python: dir() does not work properly.
Solution: Python patch 8. Add __dir__ method to all objects with custom
tp_getattr supplemented by __members__ attribute for at least
python-2* versions. __members__ is not mentioned in python-3*
dir() output even if it is accessible. (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 29 May 2013 22:36:10 +0200 |
parents | 0cf552b325b5 |
children | 90beab957ba9 |
comparison
equal
deleted
inserted
replaced
4598:18914d6c96c8 | 4599:89bec74fd793 |
---|---|
667 ('vim.current.tabpage', 'TabPage'), | 667 ('vim.current.tabpage', 'TabPage'), |
668 ): | 668 ): |
669 cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr))) | 669 cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr))) |
670 EOF | 670 EOF |
671 :" | 671 :" |
672 :" Test __dir__() method | |
673 py3 << EOF | |
674 for name, o in ( | |
675 ('current', vim.current), | |
676 ('buffer', vim.current.buffer), | |
677 ('window', vim.current.window), | |
678 ('tabpage', vim.current.tabpage), | |
679 ('range', vim.current.range), | |
680 ('dictionary', vim.bindeval('{}')), | |
681 ('list', vim.bindeval('[]')), | |
682 ('function', vim.bindeval('function("tr")')), | |
683 ('output', sys.stdout), | |
684 ): | |
685 cb.append(name + ':' + ','.join(dir(o))) | |
686 del name | |
687 del o | |
688 EOF | |
689 :" | |
672 :" Test exceptions | 690 :" Test exceptions |
673 :fun Exe(e) | 691 :fun Exe(e) |
674 : execute a:e | 692 : execute a:e |
675 :endfun | 693 :endfun |
676 py3 << EOF | 694 py3 << EOF |