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:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0097d726 in ?? () from /usr/lib/libpython2.6.so.1.0
> (gdb) where
> #0 0x0097d726 in ?? () from /usr/lib/libpython2.6.so.1.0
> #1 0x009c2c5f in PyEval_EvalFrameEx () from
> /usr/lib/libpython2.6.so.1.0 #2 0x009c3b66 in
> PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0 #3
> 0x009c3b66 in PyEval_EvalFrameEx () from
> /usr/lib/libpython2.6.so.1.0 #4 0x009c52b9 in
> PyEval_EvalCodeEx () from /usr/lib/libpython2.6.so.1.0 #5
> 0x009c359d in PyEval_EvalFrameEx () from
> /usr/lib/libpython2.6.so.1.0 #6 0x009c3b66 in
> PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0 #7
> 0x009c52b9 in PyEval_EvalCodeEx () from
> /usr/lib/libpython2.6.so.1.0 #8 0x0094d62f in ?? () from
> /usr/lib/libpython2.6.so.1.0 #9 0x0091e77c in PyObject_Call
> () from /usr/lib/libpython2.6.so.1.0 #10 0x00930604 in ?? ()
> from /usr/lib/libpython2.6.so.1.0 #11 0x0091e77c in
> PyObject_Call () from /usr/lib/libpython2.6.so.1.0 #12
> 0x0092f816 in ?? () from /usr/lib/libpython2.6.so.1.0 #13
> 0x0091e77c in PyObject_Call () from
> /usr/lib/libpython2.6.so.1.0 #14 0x009c23aa in
> PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0 #15
> 0x009c52b9 in PyEval_EvalCodeEx () from
> /usr/lib/libpython2.6.so.1.0 #16 0x0094d537 in ?? () from
> /usr/lib/libpython2.6.so.1.0 #17 0x0091e77c in PyObject_Call
> () from /usr/lib/libpython2.6.so.1.0 #18 0x00930604 in ?? ()
> from /usr/lib/libpython2.6.so.1.0 #19 0x0091e77c in
> PyObject_Call () from /usr/lib/libpython2.6.so.1.0 #20
> 0x0098667d in ?? () from /usr/lib/libpython2.6.so.1.0 #21
> 0x0091e77c in PyObject_Call () from
> /usr/lib/libpython2.6.so.1.0 #22 0x009c2f42 in
> PyEval_EvalFrameEx () from /usr/lib/libpython2.6.so.1.0 #23
> 0x009c52b9 in PyEval_EvalCodeEx () from
> /usr/lib/libpython2.6.so.1.0 #24 0x009c53d3 in
> PyEval_EvalCode () from /usr/lib/libpython2.6.so.1.0 #25
> 0x009e2f8e in PyRun_StringFlags () from
> /usr/lib/libpython2.6.so.1.0 #26 0x009e4333 in
> PyRun_SimpleStringFlags () from /usr/lib/libpython2.6.so.1.0
> #27 0x081f80f2 in DoPythonCommand (eap=0xbfffee0c,
> cmd=0x839cb2f "help(dir)") at if_python.c:650
> #28 0x081f816b in ex_python (eap=0xbfffee0c) at
> if_python.c:687 #29 0x080c2ee2 in do_one_cmd
> (cmdlinep=0xbfffefc0, sourcing=0, cstack=0xbfffefc8,
> fgetline=0x80d61a2 <getexline>, cookie=0x0) at
> ex_docmd.c:2657
> #30 0x080c07ce in do_cmdline (cmdline=0x0, fgetline=0x80d61a2
> <getexline>, cookie=0x0, flags=0) at ex_docmd.c:1123
> #31 0x0813e9ce in nv_colon (cap=0xbffff320) at normal.c:5342
> #32 0x08138041 in normal_cmd (oap=0xbffff3dc, toplevel=1) at
> normal.c:1193 #33 0x08200e7c in main_loop (cmdwin=0,
> noexmode=0) at main.c:1262 #34 0x082008a5 in main (argc=1,
> argv=0xbffff624) at main.c:964
>
> Does someone have an idea why this happens or how to fix it?
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.
Tobias Columbus
--
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