Python 3.7 support
A small patch to tweak the tests to support output differences with
Python 3.7 (currently in beta).
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:
0001-Tweak-tests-to-support-Python-3.7.patchtext/plain; charset=UTF-8; name=0001-Tweak-tests-to-support-Python-3.7.patch; x-mac-creator=0; x-mac-type=0Download
From 543840cbe29653c18cce8d1ab4af4daac5c4899b Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 13 Feb 2018 16:13:20 -0500
Subject: [PATCH] Tweak tests to support Python 3.7
Python 3.7 removes the trailing comma in the repr() of
BaseException (see <https://bugs.python.org/issue30399>), leading to
test output differences. Work around that by composing the equivalent
test output in a more manual way.
---
src/pl/plpython/expected/plpython_subtransaction.out | 6 +++---
src/pl/plpython/sql/plpython_subtransaction.sql | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pl/plpython/expected/plpython_subtransaction.out b/src/pl/plpython/expected/plpython_subtransaction.out
index da3b312a06..b38cde8d2d 100644
--- a/src/pl/plpython/expected/plpython_subtransaction.out
+++ b/src/pl/plpython/expected/plpython_subtransaction.out
@@ -134,7 +134,7 @@ with plpy.subtransaction():
except plpy.SPIError, e:
if not swallow:
raise
- plpy.notice("Swallowed %r" % e)
+ plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
return "ok"
$$ LANGUAGE plpythonu;
SELECT subtransaction_nested_test();
@@ -153,7 +153,7 @@ SELECT * FROM subtransaction_tbl;
TRUNCATE subtransaction_tbl;
SELECT subtransaction_nested_test('t');
-NOTICE: Swallowed SyntaxError('syntax error at or near "error"',)
+NOTICE: Swallowed SyntaxError('syntax error at or near "error"')
subtransaction_nested_test
----------------------------
ok
@@ -178,7 +178,7 @@ with plpy.subtransaction():
return "ok"
$$ LANGUAGE plpythonu;
SELECT subtransaction_deeply_nested_test();
-NOTICE: Swallowed SyntaxError('syntax error at or near "error"',)
+NOTICE: Swallowed SyntaxError('syntax error at or near "error"')
subtransaction_deeply_nested_test
-----------------------------------
ok
diff --git a/src/pl/plpython/sql/plpython_subtransaction.sql b/src/pl/plpython/sql/plpython_subtransaction.sql
index 3c188e3dd2..398c65720c 100644
--- a/src/pl/plpython/sql/plpython_subtransaction.sql
+++ b/src/pl/plpython/sql/plpython_subtransaction.sql
@@ -80,7 +80,7 @@ CREATE FUNCTION subtransaction_nested_test(swallow boolean = 'f') RETURNS text
except plpy.SPIError, e:
if not swallow:
raise
- plpy.notice("Swallowed %r" % e)
+ plpy.notice("Swallowed %s(%r)" % (e.__class__.__name__, e.args[0]))
return "ok"
$$ LANGUAGE plpythonu;
--
2.16.1
On Tue, Feb 13, 2018 at 04:17:13PM -0500, Peter Eisentraut wrote:
A small patch to tweak the tests to support output differences with
Python 3.7 (currently in beta).
Wouldn't it be better to wait for the version to be released before
pushing anything in the tree? If there are again changes when this
comes out as GA then an extra patch would be needed.
--
Michael
On 2/13/18 21:45, Michael Paquier wrote:
On Tue, Feb 13, 2018 at 04:17:13PM -0500, Peter Eisentraut wrote:
A small patch to tweak the tests to support output differences with
Python 3.7 (currently in beta).Wouldn't it be better to wait for the version to be released before
pushing anything in the tree? If there are again changes when this
comes out as GA then an extra patch would be needed.
Sure, we can just leave it here for the record until the release comes
closer.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On 2/14/18 21:25, Peter Eisentraut wrote:
On 2/13/18 21:45, Michael Paquier wrote:
On Tue, Feb 13, 2018 at 04:17:13PM -0500, Peter Eisentraut wrote:
A small patch to tweak the tests to support output differences with
Python 3.7 (currently in beta).Wouldn't it be better to wait for the version to be released before
pushing anything in the tree? If there are again changes when this
comes out as GA then an extra patch would be needed.Sure, we can just leave it here for the record until the release comes
closer.
I have committed this now, since the release of Python 3.7 is soon.
I'll let the build farm have a pass at it, then backport it for the
upcoming minor releases.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
I have committed this now, since the release of Python 3.7 is soon.
I'll let the build farm have a pass at it, then backport it for the
upcoming minor releases.
gaur/pademelon (Python 2.5) not very happy :-(. Let me know if you'd
like me to try anything particular there.
regards, tom lane
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
I have committed this now, since the release of Python 3.7 is soon.
I'll let the build farm have a pass at it, then backport it for the
upcoming minor releases.
If you're intending to push this into the back branches before Monday's
releases, please do it *today*, the sooner the better. We are rapidly
closing in on the point where we'd not have a full set of buildfarm runs
done before the wrap. That is not a good situation for a patch with
portability implications.
regards, tom lane