aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-08-29 11:10:17 +0200
committerPeter Eisentraut <peter_e@gmx.net>2018-09-05 16:32:38 +0200
commitf5a6509bb1ec5222a707205941a40f280f3e6e15 (patch)
treeca8a86da2a1e7d262d62fc0e42246aa7e8822ef4 /src
parentdd6073f22a6b5dd6181d8324465dd3c0bf1851e8 (diff)
downloadpostgresql-f5a6509bb1ec5222a707205941a40f280f3e6e15.tar.gz
postgresql-f5a6509bb1ec5222a707205941a40f280f3e6e15.zip
PL/Python: Remove use of simple slicing API
The simple slicing API (sq_slice, sq_ass_slice) has been deprecated since Python 2.0 and has been removed altogether in Python 3, so remove those functions from the PLyResult class. Instead, the non-slice mapping functions mp_subscript and mp_ass_subscript can take slice objects as an index. Since we just pass the index through to the underlying list object, we already support that. Test coverage was already in place.
Diffstat (limited to 'src')
-rw-r--r--src/pl/plpython/plpy_resultobject.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/pl/plpython/plpy_resultobject.c b/src/pl/plpython/plpy_resultobject.c
index ca70e256892..4064f6a7a26 100644
--- a/src/pl/plpython/plpy_resultobject.c
+++ b/src/pl/plpython/plpy_resultobject.c
@@ -20,8 +20,6 @@ static PyObject *PLy_result_nrows(PyObject *self, PyObject *args);
static PyObject *PLy_result_status(PyObject *self, PyObject *args);
static Py_ssize_t PLy_result_length(PyObject *arg);
static PyObject *PLy_result_item(PyObject *arg, Py_ssize_t idx);
-static PyObject *PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx);
-static int PLy_result_ass_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject *slice);
static PyObject *PLy_result_str(PyObject *arg);
static PyObject *PLy_result_subscript(PyObject *arg, PyObject *item);
static int PLy_result_ass_subscript(PyObject *self, PyObject *item, PyObject *value);
@@ -35,9 +33,9 @@ static PySequenceMethods PLy_result_as_sequence = {
NULL, /* sq_concat */
NULL, /* sq_repeat */
PLy_result_item, /* sq_item */
- PLy_result_slice, /* sq_slice */
+ NULL, /* sq_slice */
NULL, /* sq_ass_item */
- PLy_result_ass_slice, /* sq_ass_slice */
+ NULL, /* sq_ass_slice */
};
static PyMappingMethods PLy_result_as_mapping = {
@@ -255,24 +253,6 @@ PLy_result_item(PyObject *arg, Py_ssize_t idx)
}
static PyObject *
-PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx)
-{
- PLyResultObject *ob = (PLyResultObject *) arg;
-
- return PyList_GetSlice(ob->rows, lidx, hidx);
-}
-
-static int
-PLy_result_ass_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject *slice)
-{
- int rv;
- PLyResultObject *ob = (PLyResultObject *) arg;
-
- rv = PyList_SetSlice(ob->rows, lidx, hidx, slice);
- return rv;
-}
-
-static PyObject *
PLy_result_str(PyObject *arg)
{
PLyResultObject *ob = (PLyResultObject *) arg;