summaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpy_cursorobject.c
diff options
context:
space:
mode:
authorPeter Eisentraut2018-01-20 13:02:01 +0000
committerPeter Eisentraut2018-01-20 13:02:01 +0000
commit918e02a221db1ee40d545cb05dc9d8d392b4b743 (patch)
tree235301bf93039d15957629b241979c3aea92c037 /src/pl/plpython/plpy_cursorobject.c
parent96102a32a374c3b81ba9c2b24bcf1943a87a9ef6 (diff)
Improve type conversion of SPI_processed in Python
The previous code converted SPI_processed to a Python float if it didn't fit into a Python int. But Python longs have unlimited precision, so use that instead in all cases. As in eee50a8d4c389171ad5180568a7221f7e9b28f09, we use the Python LongLong API unconditionally for simplicity. Reviewed-by: Tom Lane <[email protected]>
Diffstat (limited to 'src/pl/plpython/plpy_cursorobject.c')
-rw-r--r--src/pl/plpython/plpy_cursorobject.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c
index a527585b818..e32bc568bc2 100644
--- a/src/pl/plpython/plpy_cursorobject.c
+++ b/src/pl/plpython/plpy_cursorobject.c
@@ -444,9 +444,7 @@ PLy_cursor_fetch(PyObject *self, PyObject *args)
ret->status = PyInt_FromLong(SPI_OK_FETCH);
Py_DECREF(ret->nrows);
- ret->nrows = (SPI_processed > (uint64) LONG_MAX) ?
- PyFloat_FromDouble((double) SPI_processed) :
- PyInt_FromLong((long) SPI_processed);
+ ret->nrows = PyLong_FromUnsignedLongLong(SPI_processed);
if (SPI_processed != 0)
{