Skip to content

Commit f5a6509

Browse files
committed
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.
1 parent dd6073f commit f5a6509

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/pl/plpython/plpy_resultobject.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ static PyObject *PLy_result_nrows(PyObject *self, PyObject *args);
2020
static PyObject *PLy_result_status(PyObject *self, PyObject *args);
2121
static Py_ssize_t PLy_result_length(PyObject *arg);
2222
static PyObject *PLy_result_item(PyObject *arg, Py_ssize_t idx);
23-
static PyObject *PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx);
24-
static int PLy_result_ass_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject *slice);
2523
static PyObject *PLy_result_str(PyObject *arg);
2624
static PyObject *PLy_result_subscript(PyObject *arg, PyObject *item);
2725
static int PLy_result_ass_subscript(PyObject *self, PyObject *item, PyObject *value);
@@ -35,9 +33,9 @@ static PySequenceMethods PLy_result_as_sequence = {
3533
NULL, /* sq_concat */
3634
NULL, /* sq_repeat */
3735
PLy_result_item, /* sq_item */
38-
PLy_result_slice, /* sq_slice */
36+
NULL, /* sq_slice */
3937
NULL, /* sq_ass_item */
40-
PLy_result_ass_slice, /* sq_ass_slice */
38+
NULL, /* sq_ass_slice */
4139
};
4240

4341
static PyMappingMethods PLy_result_as_mapping = {
@@ -254,24 +252,6 @@ PLy_result_item(PyObject *arg, Py_ssize_t idx)
254252
return rv;
255253
}
256254

257-
static PyObject *
258-
PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx)
259-
{
260-
PLyResultObject *ob = (PLyResultObject *) arg;
261-
262-
return PyList_GetSlice(ob->rows, lidx, hidx);
263-
}
264-
265-
static int
266-
PLy_result_ass_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject *slice)
267-
{
268-
int rv;
269-
PLyResultObject *ob = (PLyResultObject *) arg;
270-
271-
rv = PyList_SetSlice(ob->rows, lidx, hidx, slice);
272-
return rv;
273-
}
274-
275255
static PyObject *
276256
PLy_result_str(PyObject *arg)
277257
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy