> 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:
SNIP
> > Does someone have an idea why this happens or how to fix it?
>
> I just had a look at what's going on there.
SNIP
> 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.
The bug is indeed in type(sys.stdout). The attached patch fixes
the problem at least here. I modified all other Type
"constructors" for consistency reasons.
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
diff --git a/src/if_python.c b/src/if_python.c
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -780,7 +780,8 @@
PythonIO_Init(void)
{
/* Fixups... */
- OutputType.ob_type = &PyType_Type;
+ // OutputType.ob_type = &PyType_Type;
+ PyType_Ready(&OutputType);
return PythonIO_Init_io();
}
@@ -1402,12 +1403,12 @@
static char *(argv[2]) = {"/must>not&exist/foo", NULL};
/* Fixups... */
- BufferType.ob_type = &PyType_Type;
- RangeType.ob_type = &PyType_Type;
- WindowType.ob_type = &PyType_Type;
- BufListType.ob_type = &PyType_Type;
- WinListType.ob_type = &PyType_Type;
- CurrentType.ob_type = &PyType_Type;
+ PyType_Ready(&BufferType);
+ PyType_Ready(&RangeType);
+ PyType_Ready(&WindowType);
+ PyType_Ready(&BufListType);
+ PyType_Ready(&WinListType);
+ PyType_Ready(&CurrentType);
/* Set sys.argv[] to avoid a crash in warn(). */
PySys_SetArgv(1, argv);