From 37f21ed132d1c5aee88e81fee0a0b7e735673d35 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 8 Jan 2020 21:48:44 +0100 Subject: Remove support for Python older than 2.6 Supporting very old Python versions is a maintenance burden, especially with the several variant test files to maintain for Python <2.6. Since we have dropped support for older OpenSSL versions in 7b283d0e1d1d79bf1c962d790c94d2a53f3bb38a, RHEL 5 is now effectively desupported, and that was also the only mainstream operating system still using Python versions before 2.6, so it's a good time to drop those as well. Reviewed-by: Tom Lane Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com --- src/pl/plpython/plpython.h | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'src/pl/plpython/plpython.h') diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h index 4a1df3ee7ea..6d981a0a06d 100644 --- a/src/pl/plpython/plpython.h +++ b/src/pl/plpython/plpython.h @@ -59,16 +59,6 @@ #include #endif -/* - * Py_ssize_t compat for Python <= 2.4 - */ -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; - -#define PY_SSIZE_T_MAX INT_MAX -#define PY_SSIZE_T_MIN INT_MIN -#endif - /* * Python 2/3 strings/unicode/bytes handling. Python 2 has strings * and unicode, Python 3 has strings, which are unicode on the C @@ -80,15 +70,6 @@ typedef int Py_ssize_t; * string to a Python string it converts the C string from the * PostgreSQL server encoding to a Python Unicode object. */ - -#if PY_VERSION_HEX < 0x02060000 -/* This is exactly the compatibility layer that Python 2.6 uses. */ -#define PyBytes_AsString PyString_AsString -#define PyBytes_FromStringAndSize PyString_FromStringAndSize -#define PyBytes_Size PyString_Size -#define PyObject_Bytes PyObject_Str -#endif - #if PY_MAJOR_VERSION >= 3 #define PyString_Check(x) 0 #define PyString_AsString(x) PLyUnicode_AsString(x) @@ -104,16 +85,6 @@ typedef int Py_ssize_t; #define PyInt_AsLong(x) PyLong_AsLong(x) #endif -/* - * PyVarObject_HEAD_INIT was added in Python 2.6. Its use is - * necessary to handle both Python 2 and 3. This replacement - * definition is for Python <=2.5 - */ -#ifndef PyVarObject_HEAD_INIT -#define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, -#endif - /* Python 3 removed the Py_TPFLAGS_HAVE_ITER flag */ #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_HAVE_ITER 0 -- cgit v1.2.3