From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: drop support for Python 2.3
Date: Tue, 7 Feb 2017 23:08:25 -0500
Message-ID: <7d5073f6-d9ea-ab09-4805-69a12f23e52f@2ndquadrant.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
I would like to propose that we drop support for Python 2.3. Reasons:
- Python 3.6 was released in December. The list of versions we need to
manage is growing.
- Older Python versions are increasingly hard to build locally for testing.
- It's unlikely that Python 2.3 is still used in practice. Python 2.4
is in RHEL 5, which is the typically the oldest mainstream OS we look at.
- We could remove some cruft from the code.
We do have buildfarm coverage on prairiedog. However, that runs a >10
year old operating system, so I think it is not representing real usage.
Patch attached.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:
[text/x-patch] 0001-Drop-support-for-Python-2.3.patch (7.0K, ../7d5073f6-d9ea-ab09-4805-69a12f23e52f@2ndquadrant.com/2-0001-Drop-support-for-Python-2.3.patch)
download | inline diff:
From 94592edd240680224e5a971e8be7a5127f193d0c Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 16 Aug 2016 12:00:00 -0400
Subject: [PATCH] Drop support for Python 2.3
---
.../hstore_plpython/expected/hstore_plpython.out | 8 ++------
contrib/hstore_plpython/sql/hstore_plpython.sql | 8 ++------
doc/src/sgml/installation.sgml | 6 +-----
src/pl/plpython/expected/plpython_ereport.out | 24 +++++++++-------------
src/pl/plpython/plpy_typeio.c | 10 ++-------
src/pl/plpython/sql/plpython_ereport.sql | 8 ++------
6 files changed, 19 insertions(+), 45 deletions(-)
diff --git a/contrib/hstore_plpython/expected/hstore_plpython.out b/contrib/hstore_plpython/expected/hstore_plpython.outindex b0025c04a8..df49cd5f37 100644--- a/contrib/hstore_plpython/expected/hstore_plpython.out+++ b/contrib/hstore_plpython/expected/hstore_plpython.out@@ -6,9 +6,7 @@ LANGUAGE plpythonu
TRANSFORM FOR TYPE hstore
AS $$
assert isinstance(val, dict)
-i = list(val.items())-i.sort()-plpy.info(i)+plpy.info(sorted(val.items()))
return len(val)
$$;
SELECT test1('aa=>bb, cc=>NULL'::hstore);
@@ -24,9 +22,7 @@ LANGUAGE plpython2u
TRANSFORM FOR TYPE hstore
AS $$
assert isinstance(val, dict)
-i = list(val.items())-i.sort()-plpy.info(i)+plpy.info(sorted(val.items()))
return len(val)
$$;
SELECT test1n('aa=>bb, cc=>NULL'::hstore);
diff --git a/contrib/hstore_plpython/sql/hstore_plpython.sql b/contrib/hstore_plpython/sql/hstore_plpython.sqlindex d55bedaf50..911bbd67fe 100644--- a/contrib/hstore_plpython/sql/hstore_plpython.sql+++ b/contrib/hstore_plpython/sql/hstore_plpython.sql@@ -7,9 +7,7 @@ CREATE FUNCTION test1(val hstore) RETURNS int
TRANSFORM FOR TYPE hstore
AS $$
assert isinstance(val, dict)
-i = list(val.items())-i.sort()-plpy.info(i)+plpy.info(sorted(val.items()))
return len(val)
$$;
@@ -22,9 +20,7 @@ CREATE FUNCTION test1n(val hstore) RETURNS int
TRANSFORM FOR TYPE hstore
AS $$
assert isinstance(val, dict)
-i = list(val.items())-i.sort()-plpy.info(i)+plpy.info(sorted(val.items()))
return len(val)
$$;
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgmlindex 4431ed75a9..231d9dea4a 100644--- a/doc/src/sgml/installation.sgml+++ b/doc/src/sgml/installation.sgml@@ -193,11 +193,7 @@ <title>Requirements</title>
language, you need a <productname>Python</productname>
installation with the header files and
the <application>distutils</application> module. The minimum
- required version is <productname>Python</productname> 2.3.- (To work with function arguments of type <type>numeric</>, a 2.3.x- installation must include the separately-available <filename>cdecimal</>- module; note the <application>PL/Python</> regression tests- will not pass if that is missing.)+ required version is <productname>Python</productname> 2.4.
<productname>Python 3</productname> is supported if it's
version 3.1 or later; but see
<![%standalone-include[the <application>PL/Python</> documentation]]>
diff --git a/src/pl/plpython/expected/plpython_ereport.out b/src/pl/plpython/expected/plpython_ereport.outindex 13bd0ab335..1dafd94c72 100644--- a/src/pl/plpython/expected/plpython_ereport.out+++ b/src/pl/plpython/expected/plpython_ereport.out@@ -94,26 +94,22 @@ kwargs = {
"column_name": _column_name, "datatype_name": _datatype_name,
"constraint_name": _constraint_name
}
-# ignore None values - should work on Python2.3-dict = {}-for k in kwargs:- if kwargs[k] is not None:- dict[k] = kwargs[k]-plpy.error(**dict)+# ignore None values+plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
$$ LANGUAGE plpythonu;
SELECT raise_exception('hello', 'world');
ERROR: plpy.Error: hello
DETAIL: world
CONTEXT: Traceback (most recent call last):
- PL/Python function "raise_exception", line 13, in <module>- plpy.error(**dict)+ PL/Python function "raise_exception", line 9, in <module>+ plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
SELECT raise_exception('message text', 'detail text', _sqlstate => 'YY333');
ERROR: plpy.Error: message text
DETAIL: detail text
CONTEXT: Traceback (most recent call last):
- PL/Python function "raise_exception", line 13, in <module>- plpy.error(**dict)+ PL/Python function "raise_exception", line 9, in <module>+ plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
SELECT raise_exception(_message => 'message text',
_detail => 'detail text',
@@ -128,8 +124,8 @@ ERROR: plpy.Error: message text
DETAIL: detail text
HINT: hint text
CONTEXT: Traceback (most recent call last):
- PL/Python function "raise_exception", line 13, in <module>- plpy.error(**dict)+ PL/Python function "raise_exception", line 9, in <module>+ plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
SELECT raise_exception(_message => 'message text',
_hint => 'hint text',
@@ -139,8 +135,8 @@ SELECT raise_exception(_message => 'message text',
ERROR: plpy.Error: message text
HINT: hint text
CONTEXT: Traceback (most recent call last):
- PL/Python function "raise_exception", line 13, in <module>- plpy.error(**dict)+ PL/Python function "raise_exception", line 9, in <module>+ plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
PL/Python function "raise_exception"
DO $$
DECLARE
diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.cindex b9c6d64baa..06743e46ed 100644--- a/src/pl/plpython/plpy_typeio.c+++ b/src/pl/plpython/plpy_typeio.c@@ -521,15 +521,9 @@ PLy_input_datum_func2(PLyDatumToOb *arg, MemoryContext arg_mcxt, Oid typeOid, He
static PyObject *
PLyBool_FromBool(PLyDatumToOb *arg, Datum d)
{
- /*- * We would like to use Py_RETURN_TRUE and Py_RETURN_FALSE here for- * generating SQL from trigger functions, but those are only supported in- * Python >= 2.4, and we support older versions.- * http://docs.python.org/api/boolObjects.html- */
if (DatumGetBool(d))
- return PyBool_FromLong(1);- return PyBool_FromLong(0);+ Py_RETURN_TRUE;+ Py_RETURN_FALSE;
}
static PyObject *
diff --git a/src/pl/plpython/sql/plpython_ereport.sql b/src/pl/plpython/sql/plpython_ereport.sqlindex 2612e93387..889293d33c 100644--- a/src/pl/plpython/sql/plpython_ereport.sql+++ b/src/pl/plpython/sql/plpython_ereport.sql@@ -55,12 +55,8 @@ CREATE OR REPLACE FUNCTION raise_exception(_message text, _detail text DEFAULT N
"column_name": _column_name, "datatype_name": _datatype_name,
"constraint_name": _constraint_name
}
-# ignore None values - should work on Python2.3-dict = {}-for k in kwargs:- if kwargs[k] is not None:- dict[k] = kwargs[k]-plpy.error(**dict)+# ignore None values+plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v))
$$ LANGUAGE plpythonu;
SELECT raise_exception('hello', 'world');
--
2.11.1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com
Subject: Re: drop support for Python 2.3
In-Reply-To: <7d5073f6-d9ea-ab09-4805-69a12f23e52f@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox