Tobias Columbus wrote:

> On Tuesday 22 March 2011 13:40:19 you wrote:
> > Kearn Holliday reported that this Python command crashes some
> > versions
> > 
> > of Vim:
> >     :python help(dir)
> > 
> > This is the stack I get in gdb:
> 
> [...]
> 
> I just had a look at what's going on there.
> :py help(dir) as well as other :py help("something that exists") 
> all crash vim.
> I tracked the problem down to a call to 
> type(sys.stdout)
> in the method pydoc.getpager(), which tries to determine what 
> pager to use.
> 
> Moreover,
> :py type(sys.stdout) 
> also causes a SIGSEV.
> 
> It seems to me that vim's sys.stdout has no well-defined python 
> type and hence this call crashes.
> 
> However, I do not know, how to fix this. An ad-hoc workaround is 
> the following (working on any machine with less installed):
> 
> :py import pydoc
> :py pydoc.pager = lambda text : pydoc.pipepager( text, 'less' )
> :py help(dir)
> 
> This makes pydoc believe that pydoc.pager already was set by 
> pydoc.getpager() and therefore the crashing pydoc.getpager() is 
> not called anymore.
> The above code causes no SIGSEV, but vim seems to somewhat broken 
> afterwards...At least it indicates that the problem really is 
> where I claim it to be.

Getting the type of something should not crash.  How do we fix this?

If we can't fix that, how do we make sys.stdout a proper object?

-- 
ARTHUR: If you do not open these doors, we will take this castle by force ...
   [A bucket of slops land on ARTHUR.  He tries to retain his dignity.]
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- 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    ///

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui