mirror of
https://github.com/postgres/postgres.git
synced 2025-08-18 12:22:09 +03:00
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 eee50a8d4c
, we use the Python
LongLong API unconditionally for simplicity.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user