forked from aniani/vim
updated for version 7.3.688
Problem: Python 3.3 is not supported. Solution: Add Python 3.3 support (Ken Takata)
This commit is contained in:
@@ -174,7 +174,12 @@ static void init_structs(void);
|
|||||||
# define _PyObject_NextNotImplemented (*py3__PyObject_NextNotImplemented)
|
# define _PyObject_NextNotImplemented (*py3__PyObject_NextNotImplemented)
|
||||||
# define PyModule_AddObject py3_PyModule_AddObject
|
# define PyModule_AddObject py3_PyModule_AddObject
|
||||||
# define PyImport_AppendInittab py3_PyImport_AppendInittab
|
# define PyImport_AppendInittab py3_PyImport_AppendInittab
|
||||||
# define _PyUnicode_AsString py3__PyUnicode_AsString
|
# if PY_VERSION_HEX >= 0x030300f0
|
||||||
|
# undef _PyUnicode_AsString
|
||||||
|
# define _PyUnicode_AsString py3_PyUnicode_AsUTF8String
|
||||||
|
# else
|
||||||
|
# define _PyUnicode_AsString py3__PyUnicode_AsString
|
||||||
|
# endif
|
||||||
# undef PyUnicode_AsEncodedString
|
# undef PyUnicode_AsEncodedString
|
||||||
# define PyUnicode_AsEncodedString py3_PyUnicode_AsEncodedString
|
# define PyUnicode_AsEncodedString py3_PyUnicode_AsEncodedString
|
||||||
# undef PyBytes_AsString
|
# undef PyBytes_AsString
|
||||||
@@ -281,7 +286,11 @@ static PyObject* py3__Py_FalseStruct;
|
|||||||
static PyObject* py3__Py_TrueStruct;
|
static PyObject* py3__Py_TrueStruct;
|
||||||
static int (*py3_PyModule_AddObject)(PyObject *m, const char *name, PyObject *o);
|
static int (*py3_PyModule_AddObject)(PyObject *m, const char *name, PyObject *o);
|
||||||
static int (*py3_PyImport_AppendInittab)(const char *name, PyObject* (*initfunc)(void));
|
static int (*py3_PyImport_AppendInittab)(const char *name, PyObject* (*initfunc)(void));
|
||||||
|
#if PY_VERSION_HEX >= 0x030300f0
|
||||||
|
static char* (*py3_PyUnicode_AsUTF8String)(PyObject *unicode);
|
||||||
|
#else
|
||||||
static char* (*py3__PyUnicode_AsString)(PyObject *unicode);
|
static char* (*py3__PyUnicode_AsString)(PyObject *unicode);
|
||||||
|
#endif
|
||||||
static PyObject* (*py3_PyUnicode_AsEncodedString)(PyObject *unicode, const char* encoding, const char* errors);
|
static PyObject* (*py3_PyUnicode_AsEncodedString)(PyObject *unicode, const char* encoding, const char* errors);
|
||||||
static char* (*py3_PyBytes_AsString)(PyObject *bytes);
|
static char* (*py3_PyBytes_AsString)(PyObject *bytes);
|
||||||
static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, int *length);
|
static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, int *length);
|
||||||
@@ -397,7 +406,11 @@ static struct
|
|||||||
{"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init},
|
{"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init},
|
||||||
{"PyModule_AddObject", (PYTHON_PROC*)&py3_PyModule_AddObject},
|
{"PyModule_AddObject", (PYTHON_PROC*)&py3_PyModule_AddObject},
|
||||||
{"PyImport_AppendInittab", (PYTHON_PROC*)&py3_PyImport_AppendInittab},
|
{"PyImport_AppendInittab", (PYTHON_PROC*)&py3_PyImport_AppendInittab},
|
||||||
|
#if PY_VERSION_HEX >= 0x030300f0
|
||||||
|
{"PyUnicode_AsUTF8String", (PYTHON_PROC*)&py3_PyUnicode_AsUTF8String},
|
||||||
|
#else
|
||||||
{"_PyUnicode_AsString", (PYTHON_PROC*)&py3__PyUnicode_AsString},
|
{"_PyUnicode_AsString", (PYTHON_PROC*)&py3__PyUnicode_AsString},
|
||||||
|
#endif
|
||||||
{"PyBytes_AsString", (PYTHON_PROC*)&py3_PyBytes_AsString},
|
{"PyBytes_AsString", (PYTHON_PROC*)&py3_PyBytes_AsString},
|
||||||
{"PyBytes_AsStringAndSize", (PYTHON_PROC*)&py3_PyBytes_AsStringAndSize},
|
{"PyBytes_AsStringAndSize", (PYTHON_PROC*)&py3_PyBytes_AsStringAndSize},
|
||||||
{"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString},
|
{"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString},
|
||||||
@@ -490,6 +503,12 @@ py3_runtime_link_init(char *libname, int verbose)
|
|||||||
|
|
||||||
/* Load unicode functions separately as only the ucs2 or the ucs4 functions
|
/* Load unicode functions separately as only the ucs2 or the ucs4 functions
|
||||||
* will be present in the library. */
|
* will be present in the library. */
|
||||||
|
#if PY_VERSION_HEX >= 0x030300f0
|
||||||
|
ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString");
|
||||||
|
ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode");
|
||||||
|
ucs_as_encoded_string = symbol_from_dll(hinstPy3,
|
||||||
|
"PyUnicode_AsEncodedString");
|
||||||
|
#else
|
||||||
ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString");
|
ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString");
|
||||||
ucs_decode = symbol_from_dll(hinstPy3,
|
ucs_decode = symbol_from_dll(hinstPy3,
|
||||||
"PyUnicodeUCS2_Decode");
|
"PyUnicodeUCS2_Decode");
|
||||||
@@ -504,6 +523,7 @@ py3_runtime_link_init(char *libname, int verbose)
|
|||||||
ucs_as_encoded_string = symbol_from_dll(hinstPy3,
|
ucs_as_encoded_string = symbol_from_dll(hinstPy3,
|
||||||
"PyUnicodeUCS4_AsEncodedString");
|
"PyUnicodeUCS4_AsEncodedString");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (ucs_from_string && ucs_decode && ucs_as_encoded_string)
|
if (ucs_from_string && ucs_decode && ucs_as_encoded_string)
|
||||||
{
|
{
|
||||||
py3_PyUnicode_FromString = ucs_from_string;
|
py3_PyUnicode_FromString = ucs_from_string;
|
||||||
@@ -600,8 +620,8 @@ static int py3initialised = 0;
|
|||||||
|
|
||||||
#define GET_ATTR_STRING(name, nameobj) \
|
#define GET_ATTR_STRING(name, nameobj) \
|
||||||
char *name = ""; \
|
char *name = ""; \
|
||||||
if(PyUnicode_Check(nameobj)) \
|
if (PyUnicode_Check(nameobj)) \
|
||||||
name = _PyUnicode_AsString(nameobj)
|
name = _PyUnicode_AsString(nameobj)
|
||||||
|
|
||||||
#define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
|
#define PY3OBJ_DELETED(obj) (obj->ob_base.ob_refcnt<=0)
|
||||||
|
|
||||||
@@ -704,6 +724,8 @@ Python3_Init(void)
|
|||||||
Py_SetPythonHome(PYTHON3_HOME);
|
Py_SetPythonHome(PYTHON3_HOME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PyImport_AppendInittab("vim", Py3Init_vim);
|
||||||
|
|
||||||
#if !defined(MACOS) || defined(MACOS_X_UNIX)
|
#if !defined(MACOS) || defined(MACOS_X_UNIX)
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
#else
|
#else
|
||||||
@@ -719,8 +741,6 @@ Python3_Init(void)
|
|||||||
if (PythonIO_Init())
|
if (PythonIO_Init())
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
PyImport_AppendInittab("vim", Py3Init_vim);
|
|
||||||
|
|
||||||
globals = PyModule_GetDict(PyImport_AddModule("__main__"));
|
globals = PyModule_GetDict(PyImport_AddModule("__main__"));
|
||||||
|
|
||||||
/* Remove the element from sys.path that was added because of our
|
/* Remove the element from sys.path that was added because of our
|
||||||
|
@@ -719,6 +719,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
688,
|
||||||
/**/
|
/**/
|
||||||
687,
|
687,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user