[postgresql] Change plpython_do test a bit so it is universal for all python versions

Honza Horak hhorak at fedoraproject.org
Fri May 23 14:54:09 UTC 2014


commit 832a5a0ffdb90adf9eb6fe03412d100192d34828
Author: Honza Horak <hhorak at redhat.com>
Date:   Fri May 23 16:53:07 2014 +0200

    Change plpython_do test a bit so it is universal for all python versions

 postgresql-python34.patch |   34 ++++++++++++++++++++++++++++++++++
 postgresql.spec           |    7 ++++++-
 2 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/postgresql-python34.patch b/postgresql-python34.patch
new file mode 100644
index 0000000..b9f3302
--- /dev/null
+++ b/postgresql-python34.patch
@@ -0,0 +1,34 @@
+The error message for undefined names *inside functions* (not for undefined
+names on global level) has changed in Python 3.4 compared to 3.3.
+
+Particularly error string "NameError: global name 'nonsense' is not defined"
+has become "ERROR:  NameError: name 'nonsense' is not defined" in Python 3.4.
+
+This patch also raises an exception, but the exceptin message is the same
+across Python versions.
+
+diff -up postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out.python34 postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out
+--- postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out.python34	2014-05-23 15:42:50.462783074 +0200
++++ postgresql-9.3.4/src/pl/plpython/expected/plpython_do.out	2014-05-23 16:09:28.501654085 +0200
+@@ -4,9 +4,9 @@ CONTEXT:  PL/Python anonymous code block
+ DO $$ plpy.notice("This is plpython2u.") $$ LANGUAGE plpython2u;
+ NOTICE:  This is plpython2u.
+ CONTEXT:  PL/Python anonymous code block
+-DO $$ nonsense $$ LANGUAGE plpythonu;
+-ERROR:  NameError: global name 'nonsense' is not defined
++DO $$ raise Exception("Sample error") $$ LANGUAGE plpythonu;
++ERROR:  Exception: Sample error
+ CONTEXT:  Traceback (most recent call last):
+   PL/Python anonymous code block, line 1, in <module>
+-    nonsense 
++    raise Exception("Sample error") 
+ PL/Python anonymous code block
+diff -up postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql.python34 postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql
+--- postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql.python34	2014-05-23 15:42:24.240756276 +0200
++++ postgresql-9.3.4/src/pl/plpython/sql/plpython_do.sql	2014-05-23 16:10:31.363475875 +0200
+@@ -2,4 +2,4 @@ DO $$ plpy.notice("This is plpythonu.")
+ 
+ DO $$ plpy.notice("This is plpython2u.") $$ LANGUAGE plpython2u;
+ 
+-DO $$ nonsense $$ LANGUAGE plpythonu;
++DO $$ raise Exception("Sample error") $$ LANGUAGE plpythonu;
diff --git a/postgresql.spec b/postgresql.spec
index ce3b2b2..9a1147f 100644
--- a/postgresql.spec
+++ b/postgresql.spec
@@ -64,7 +64,7 @@ Summary: PostgreSQL client programs
 Name: postgresql
 %global majorversion 9.3
 Version: 9.3.4
-Release: 3%{?dist}
+Release: 4%{?dist}
 
 # The PostgreSQL license is very similar to other MIT licenses, but the OSI
 # recognizes it as an independent license, so we do as well.
@@ -108,6 +108,7 @@ Patch3: postgresql-perl-rpath.patch
 Patch4: postgresql-config-comment.patch
 Patch5: postgresql-var-run-socket.patch
 Patch6: postgresql-man.patch
+Patch7: postgresql-python34.patch
 
 BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk help2man
 BuildRequires: perl(ExtUtils::Embed), perl-devel
@@ -335,6 +336,7 @@ benchmarks.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 
 # We used to run autoconf here, but there's no longer any real need to,
 # since Postgres ships with a reasonably modern configure script.
@@ -1131,6 +1133,9 @@ fi
 %endif
 
 %changelog
+* Fri May 23 2014 Honza Horak <hhorak at redhat.com> - 9.3.4-4
+- Change plpython_do test a bit so it is universal for all python versions
+
 * Wed May 21 2014 Jaroslav Škarvada <jskarvad at redhat.com> - 9.3.4-3
 - Rebuilt for https://fedoraproject.org/wiki/Changes/f21tcl86
 


More information about the scm-commits mailing list