aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-01-19 17:22:38 -0500
committerPeter Eisentraut <peter_e@gmx.net>2018-01-19 17:22:38 -0500
commiteee50a8d4c389171ad5180568a7221f7e9b28f09 (patch)
tree9e8840ca951d2ec273b805ab3e51a40d058d5eea
parent2f178441044be430f6b4d626e4dae68a9a6f6cec (diff)
downloadpostgresql-eee50a8d4c389171ad5180568a7221f7e9b28f09.tar.gz
postgresql-eee50a8d4c389171ad5180568a7221f7e9b28f09.zip
PL/Python: Simplify PLyLong_FromInt64
We don't actually need two code paths, one for 32 bits and one for 64 bits. Since the existing code already assumed that "long long" is available, we can just use PyLong_FromLongLong() for 64 bits as well. In Python 2.5 and later, PyLong_FromLong() and PyLong_FromLongLong() use the same code, so there will be no difference for 64-bit platforms. In Python 2.4, the code is different, but performance testing showed no noticeable difference in PL/Python, and that Python version is ancient anyway. Discussion: https://www.postgresql.org/message-id/0a02203c-e157-55b2-464e-6087066a1849@2ndquadrant.com
-rw-r--r--src/pl/plpython/plpy_typeio.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c
index c48e8fd5f3b..6c6b16f4d75 100644
--- a/src/pl/plpython/plpy_typeio.c
+++ b/src/pl/plpython/plpy_typeio.c
@@ -618,11 +618,7 @@ PLyInt_FromInt32(PLyDatumToOb *arg, Datum d)
static PyObject *
PLyLong_FromInt64(PLyDatumToOb *arg, Datum d)
{
- /* on 32 bit platforms "long" may be too small */
- if (sizeof(int64) > sizeof(long))
- return PyLong_FromLongLong(DatumGetInt64(d));
- else
- return PyLong_FromLong(DatumGetInt64(d));
+ return PyLong_FromLongLong(DatumGetInt64(d));
}
static PyObject *