summaryrefslogtreecommitdiff
path: root/src/if_python3.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-07-04 22:03:25 +0200
committerBram Moolenaar <Bram@vim.org>2018-07-04 22:03:25 +0200
commit3b48b11c07b85520f4ca3566e92c3f6486509b72 (patch)
tree51c37e4be094f9b0666c9fa161b34d4d694d9580 /src/if_python3.c
parentf0447e89a52885630947510f2d1b55f665a1a20e (diff)
downloadvim-git-3b48b11c07b85520f4ca3566e92c3f6486509b72.tar.gz
patch 8.1.0147: compiler warning when building with Python 3.7v8.1.0147
Problem: Compiler warning when building with Python 3.7. Solution: #undef PySlice_GetIndicesEx before redefining it. (Ozaki Kiichi, closes #3153)
Diffstat (limited to 'src/if_python3.c')
-rw-r--r--src/if_python3.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/if_python3.c b/src/if_python3.c
index f713f5623..b87e13766 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -167,6 +167,11 @@ typedef PySliceObject PySliceObject_T;
# define PySequence_Fast py3_PySequence_Fast
# define PyTuple_Size py3_PyTuple_Size
# define PyTuple_GetItem py3_PyTuple_GetItem
+# if PY_VERSION_HEX >= 0x030601f0
+# define PySlice_AdjustIndices py3_PySlice_AdjustIndices
+# define PySlice_Unpack py3_PySlice_Unpack
+# endif
+# undef PySlice_GetIndicesEx
# define PySlice_GetIndicesEx py3_PySlice_GetIndicesEx
# define PyImport_ImportModule py3_PyImport_ImportModule
# define PyObject_Init py3__PyObject_Init
@@ -305,6 +310,12 @@ static Py_ssize_t (*py3_PyTuple_Size)(PyObject *);
static PyObject* (*py3_PyTuple_GetItem)(PyObject *, Py_ssize_t);
static int (*py3_PyMapping_Check)(PyObject *);
static PyObject* (*py3_PyMapping_Keys)(PyObject *);
+# if PY_VERSION_HEX >= 0x030601f0
+static int (*py3_PySlice_AdjustIndices)(Py_ssize_t length,
+ Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step);
+static int (*py3_PySlice_Unpack)(PyObject *slice,
+ Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step);
+# endif
static int (*py3_PySlice_GetIndicesEx)(PySliceObject_T *r, Py_ssize_t length,
Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step,
Py_ssize_t *slicelen);
@@ -474,6 +485,10 @@ static struct
{"PySequence_Fast", (PYTHON_PROC*)&py3_PySequence_Fast},
{"PyTuple_Size", (PYTHON_PROC*)&py3_PyTuple_Size},
{"PyTuple_GetItem", (PYTHON_PROC*)&py3_PyTuple_GetItem},
+# if PY_VERSION_HEX >= 0x030601f0
+ {"PySlice_AdjustIndices", (PYTHON_PROC*)&py3_PySlice_AdjustIndices},
+ {"PySlice_Unpack", (PYTHON_PROC*)&py3_PySlice_Unpack},
+# endif
{"PySlice_GetIndicesEx", (PYTHON_PROC*)&py3_PySlice_GetIndicesEx},
{"PyErr_NoMemory", (PYTHON_PROC*)&py3_PyErr_NoMemory},
{"Py_Finalize", (PYTHON_PROC*)&py3_Py_Finalize},