示例#1
0
    static int
PythonMod_Init(void)
{
    /* The special value is removed from sys.path in Python_Init(). */
    static char	*(argv[2]) = {"/must>not&exist/foo", NULL};

    if (init_types())
	return -1;

    /* Set sys.argv[] to avoid a crash in warn(). */
    PySys_SetArgv(1, argv);

    vim_module = Py_InitModule4("vim", VimMethods, (char *)NULL,
				(PyObject *)NULL, PYTHON_API_VERSION);

    if (populate_module(vim_module))
	return -1;

    if (init_sys_path())
	return -1;

    return 0;
}
示例#2
0
static PyObject *
Py3Init_vim(void)
{
	/* The special value is removed from sys.path in Python3_Init(). */
	static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL};

	if (init_types())
		return NULL;

	/* Set sys.argv[] to avoid a crash in warn(). */
	PySys_SetArgv(1, argv);

	if ((vim_module = PyModule_Create(&vimmodule)) == NULL)
		return NULL;

	if (populate_module(vim_module))
		return NULL;

	if (init_sys_path())
		return NULL;

	return vim_module;
}