diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-06-23 14:16:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-06-23 14:16:57 +0200 |
commit | 141be8a585145d2217fb425739ccc121aed4a8d4 (patch) | |
tree | 1fbdd6ad7db5cc23313f05d9ef8f4f1aaa0772f1 /src/if_python.c | |
parent | c476e52fcaf9e1ad779add6368e4f46b2c0d881c (diff) | |
download | vim-141be8a585145d2217fb425739ccc121aed4a8d4.zip |
updated for version 7.3.1231
Problem: Python: use of numbers not consistent.
Solution: Add support for Number protocol. (ZyX)
Diffstat (limited to 'src/if_python.c')
-rw-r--r-- | src/if_python.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/if_python.c b/src/if_python.c index 28cd36f85..da2783889 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -220,6 +220,7 @@ struct PyMethodDef { Py_ssize_t a; }; # define PyObject_CallFunctionObjArgs dll_PyObject_CallFunctionObjArgs # define PyObject_CallFunction dll_PyObject_CallFunction # define PyObject_Call dll_PyObject_Call +# define PyObject_Repr dll_PyObject_Repr # define PyString_AsString dll_PyString_AsString # define PyString_AsStringAndSize dll_PyString_AsStringAndSize # define PyString_FromString dll_PyString_FromString @@ -233,6 +234,8 @@ struct PyMethodDef { Py_ssize_t a; }; # define PyFloat_AsDouble dll_PyFloat_AsDouble # define PyFloat_FromDouble dll_PyFloat_FromDouble # define PyFloat_Type (*dll_PyFloat_Type) +# define PyNumber_Check dll_PyNumber_Check +# define PyNumber_Long dll_PyNumber_Long # define PyImport_AddModule (*dll_PyImport_AddModule) # define PySys_SetObject dll_PySys_SetObject # define PySys_GetObject dll_PySys_GetObject @@ -360,6 +363,7 @@ static PyObject* (*dll_PyObject_SetAttrString)(PyObject *, const char *, PyObjec static PyObject* (*dll_PyObject_CallFunctionObjArgs)(PyObject *, ...); static PyObject* (*dll_PyObject_CallFunction)(PyObject *, char *, ...); static PyObject* (*dll_PyObject_Call)(PyObject *, PyObject *, PyObject *); +static PyObject* (*dll_PyObject_Repr)(PyObject *); static char*(*dll_PyString_AsString)(PyObject *); static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, int *); static PyObject*(*dll_PyString_FromString)(const char *); @@ -372,6 +376,8 @@ static PyObject *(*py_PyUnicode_AsEncodedString)(PyObject *, char *, char *); static double(*dll_PyFloat_AsDouble)(PyObject *); static PyObject*(*dll_PyFloat_FromDouble)(double); static PyTypeObject* dll_PyFloat_Type; +static int(*dll_PyNumber_Check)(PyObject *); +static PyObject*(*dll_PyNumber_Long)(PyObject *); static int(*dll_PySys_SetObject)(char *, PyObject *); static PyObject *(*dll_PySys_GetObject)(char *); static int(*dll_PySys_SetArgv)(int, char **); @@ -440,6 +446,7 @@ static PyObject *imp_PyExc_TypeError; static PyObject *imp_PyExc_ValueError; static PyObject *imp_PyExc_RuntimeError; static PyObject *imp_PyExc_ImportError; +static PyObject *imp_PyExc_OverflowError; # define PyExc_AttributeError imp_PyExc_AttributeError # define PyExc_IndexError imp_PyExc_IndexError @@ -449,6 +456,7 @@ static PyObject *imp_PyExc_ImportError; # define PyExc_ValueError imp_PyExc_ValueError # define PyExc_RuntimeError imp_PyExc_RuntimeError # define PyExc_ImportError imp_PyExc_ImportError +# define PyExc_OverflowError imp_PyExc_OverflowError /* * Table of name to function pointer of python. @@ -533,6 +541,7 @@ static struct {"PyObject_CallFunctionObjArgs", (PYTHON_PROC*)&dll_PyObject_CallFunctionObjArgs}, {"PyObject_CallFunction", (PYTHON_PROC*)&dll_PyObject_CallFunction}, {"PyObject_Call", (PYTHON_PROC*)&dll_PyObject_Call}, + {"PyObject_Repr", (PYTHON_PROC*)&dll_PyObject_Repr}, {"PyString_AsString", (PYTHON_PROC*)&dll_PyString_AsString}, {"PyString_AsStringAndSize", (PYTHON_PROC*)&dll_PyString_AsStringAndSize}, {"PyString_FromString", (PYTHON_PROC*)&dll_PyString_FromString}, @@ -545,6 +554,8 @@ static struct {"PyFloat_AsDouble", (PYTHON_PROC*)&dll_PyFloat_AsDouble}, {"PyFloat_FromDouble", (PYTHON_PROC*)&dll_PyFloat_FromDouble}, {"PyImport_AddModule", (PYTHON_PROC*)&dll_PyImport_AddModule}, + {"PyNumber_Check", (PYTHON_PROC*)&dll_PyNumber_Check}, + {"PyNumber_Long", (PYTHON_PROC*)&dll_PyNumber_Long}, {"PySys_SetObject", (PYTHON_PROC*)&dll_PySys_SetObject}, {"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject}, {"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv}, @@ -722,6 +733,7 @@ get_exceptions(void) imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError"); imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError"); imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError"); + imp_PyExc_OverflowError = PyDict_GetItemString(exdict, "OverflowError"); Py_XINCREF(imp_PyExc_AttributeError); Py_XINCREF(imp_PyExc_IndexError); Py_XINCREF(imp_PyExc_KeyError); @@ -730,6 +742,7 @@ get_exceptions(void) Py_XINCREF(imp_PyExc_ValueError); Py_XINCREF(imp_PyExc_RuntimeError); Py_XINCREF(imp_PyExc_ImportError); + Py_XINCREF(imp_PyExc_OverflowError); Py_XDECREF(exmod); } #endif /* DYNAMIC_PYTHON */ |