Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbJZx-000827-VA for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Feb 2017 04:10:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cbJZx-0006Om-Es for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Feb 2017 04:10:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cbJYW-0004oD-S2 for pgsql-hackers@postgresql.org; Wed, 08 Feb 2017 04:08:32 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cbJYR-0003Qf-KK for pgsql-hackers@postgresql.org; Wed, 08 Feb 2017 04:08:31 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 24F1E2084D for ; Tue, 7 Feb 2017 23:08:26 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Tue, 07 Feb 2017 23:08:26 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=b9YFkk8tJtPQ8rblwoUwHK5MTtY=; b=SW39B 8jQbzV/rfsdODo2USYKHCaQBOgc6NnEOSuaiYp3Qg/lsl5/Xwe/X5m9UUZ8Q4BDV JeFTs4ic0pqLaNy0qTDFLWjtXLK+V8bzFIVj+P4ntWB5l+5GSkLKREA9UMwTJ6tC +xaSXEcleFpsoDU6oF5XYF2TfQY9XnvlBQe11M= X-ME-Sender: X-Sasl-enc: fgZPJFAjpdLraV1XRGW/dq17syaqpgDbF8DRngtJFncP 1486526905 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id D31C12453A for ; Tue, 7 Feb 2017 23:08:25 -0500 (EST) From: Peter Eisentraut Subject: drop support for Python 2.3 Organization: 2ndQuadrant To: pgsql-hackers Message-ID: <7d5073f6-d9ea-ab09-4805-69a12f23e52f@2ndquadrant.com> Date: Tue, 7 Feb 2017 23:08:25 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C3DB11620452DE0BB0F60B38" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------C3DB11620452DE0BB0F60B38 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 --------------C3DB11620452DE0BB0F60B38 Content-Type: text/x-patch; name="0001-Drop-support-for-Python-2.3.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Drop-support-for-Python-2.3.patch" =46rom 94592edd240680224e5a971e8be7a5127f193d0c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut 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.out index 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 =3D list(val.items()) -i.sort() -plpy.info(i) +plpy.info(sorted(val.items())) return len(val) $$; SELECT test1('aa=3D>bb, cc=3D>NULL'::hstore); @@ -24,9 +22,7 @@ LANGUAGE plpython2u TRANSFORM FOR TYPE hstore AS $$ assert isinstance(val, dict) -i =3D list(val.items()) -i.sort() -plpy.info(i) +plpy.info(sorted(val.items())) return len(val) $$; SELECT test1n('aa=3D>bb, cc=3D>NULL'::hstore); diff --git a/contrib/hstore_plpython/sql/hstore_plpython.sql b/contrib/hsto= re_plpython/sql/hstore_plpython.sql index 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 =3D list(val.items()) -i.sort() -plpy.info(i) +plpy.info(sorted(val.items())) return len(val) $$; =20 @@ -22,9 +20,7 @@ CREATE FUNCTION test1n(val hstore) RETURNS int TRANSFORM FOR TYPE hstore AS $$ assert isinstance(val, dict) -i =3D list(val.items()) -i.sort() -plpy.info(i) +plpy.info(sorted(val.items())) return len(val) $$; =20 diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 4431ed75a9..231d9dea4a 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -193,11 +193,7 @@ Requirements language, you need a Python installation with the header files and the distutils module. The minimum - required version is Python 2.3. - (To work with function arguments of type numeric, a 2.3.x - installation must include the separately-available cdecima= l - module; note the PL/Python regression tests - will not pass if that is missing.) + required version is Python 2.4. Python 3 is supported if it's version 3.1 or later; but see PL/Python documentation]]> diff --git a/src/pl/plpython/expected/plpython_ereport.out b/src/pl/plpytho= n/expected/plpython_ereport.out index 13bd0ab335..1dafd94c72 100644 --- a/src/pl/plpython/expected/plpython_ereport.out +++ b/src/pl/plpython/expected/plpython_ereport.out @@ -94,26 +94,22 @@ kwargs =3D { "column_name": _column_name, "datatype_name": _datatype_name, "constraint_name": _constraint_name } -# ignore None values - should work on Python2.3 -dict =3D {} -for k in kwargs: - if kwargs[k] is not None: - dict[k] =3D 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 - plpy.error(**dict) + PL/Python function "raise_exception", line 9, in + 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 =3D> 'YY33= 3'); ERROR: plpy.Error: message text DETAIL: detail text CONTEXT: Traceback (most recent call last): - PL/Python function "raise_exception", line 13, in - plpy.error(**dict) + PL/Python function "raise_exception", line 9, in + plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v)) PL/Python function "raise_exception" SELECT raise_exception(_message =3D> 'message text', _detail =3D> '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 - plpy.error(**dict) + PL/Python function "raise_exception", line 9, in + plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v)) PL/Python function "raise_exception" SELECT raise_exception(_message =3D> 'message text', _hint =3D> 'hint text', @@ -139,8 +135,8 @@ SELECT raise_exception(_message =3D> 'message text', ERROR: plpy.Error: message text HINT: hint text CONTEXT: Traceback (most recent call last): - PL/Python function "raise_exception", line 13, in - plpy.error(**dict) + PL/Python function "raise_exception", line 9, in + 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.c index 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 >=3D 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; } =20 static PyObject * diff --git a/src/pl/plpython/sql/plpython_ereport.sql b/src/pl/plpython/sql= /plpython_ereport.sql index 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 =3D {} -for k in kwargs: - if kwargs[k] is not None: - dict[k] =3D kwargs[k] -plpy.error(**dict) +# ignore None values +plpy.error(**dict((k, v) for k, v in iter(kwargs.items()) if v)) $$ LANGUAGE plpythonu; =20 SELECT raise_exception('hello', 'world'); --=20 2.11.1 --------------C3DB11620452DE0BB0F60B38 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------C3DB11620452DE0BB0F60B38--