diff options
author | Andres Freund | 2022-03-08 02:30:28 +0000 |
---|---|---|
committer | Andres Freund | 2022-03-08 02:30:28 +0000 |
commit | 9b7e24a2cb37fb52af13219f625cd719e364a346 (patch) | |
tree | c35fe718f0a8d8723631b5759a47e37bfb6f7fbf /src/pl/plpython/plpy_resultobject.c | |
parent | db23464715f4792298c639153dda7bfd9ad9d602 (diff) |
plpython: Code cleanup related to removal of Python 2 support.
Since 19252e8ec93 we reject Python 2 during build configuration. Now that the
dust on the buildfarm has settled, remove Python 2 specific code, including
the "Python 2/3 porting layer".
The code to detect conflicts between plpython using Python 2 and 3 is not
removed, in case somebody creates an out-of-tree version adding back support
for Python 2.
Reviewed-By: Peter Eisentraut <[email protected]>
Reviewed-By: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/pl/plpython/plpy_resultobject.c')
-rw-r--r-- | src/pl/plpython/plpy_resultobject.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/pl/plpython/plpy_resultobject.c b/src/pl/plpython/plpy_resultobject.c index 54f39419c84..a8516b2db30 100644 --- a/src/pl/plpython/plpy_resultobject.c +++ b/src/pl/plpython/plpy_resultobject.c @@ -76,7 +76,7 @@ PLy_result_new(void) Py_INCREF(Py_None); ob->status = Py_None; - ob->nrows = PyInt_FromLong(-1); + ob->nrows = PyLong_FromLong(-1); ob->rows = PyList_New(0); ob->tupdesc = NULL; if (!ob->rows) @@ -125,7 +125,7 @@ PLy_result_colnames(PyObject *self, PyObject *unused) { Form_pg_attribute attr = TupleDescAttr(ob->tupdesc, i); - PyList_SET_ITEM(list, i, PyString_FromString(NameStr(attr->attname))); + PyList_SET_ITEM(list, i, PLyUnicode_FromString(NameStr(attr->attname))); } return list; @@ -151,7 +151,7 @@ PLy_result_coltypes(PyObject *self, PyObject *unused) { Form_pg_attribute attr = TupleDescAttr(ob->tupdesc, i); - PyList_SET_ITEM(list, i, PyInt_FromLong(attr->atttypid)); + PyList_SET_ITEM(list, i, PyLong_FromLong(attr->atttypid)); } return list; @@ -177,7 +177,7 @@ PLy_result_coltypmods(PyObject *self, PyObject *unused) { Form_pg_attribute attr = TupleDescAttr(ob->tupdesc, i); - PyList_SET_ITEM(list, i, PyInt_FromLong(attr->atttypmod)); + PyList_SET_ITEM(list, i, PyLong_FromLong(attr->atttypmod)); } return list; @@ -226,19 +226,11 @@ PLy_result_str(PyObject *arg) { PLyResultObject *ob = (PLyResultObject *) arg; -#if PY_MAJOR_VERSION >= 3 return PyUnicode_FromFormat("<%s status=%S nrows=%S rows=%S>", Py_TYPE(ob)->tp_name, ob->status, ob->nrows, ob->rows); -#else - return PyString_FromFormat("<%s status=%ld nrows=%ld rows=%s>", - ob->ob_type->tp_name, - PyInt_AsLong(ob->status), - PyInt_AsLong(ob->nrows), - PyString_AsString(PyObject_Str(ob->rows))); -#endif } static PyObject * |