pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgresql test failure with Python 3.4.0 in plpython_do
4+ messages / 2 participants
[nested] [flat]
* postgresql test failure with Python 3.4.0 in plpython_do
@ 2014-05-20 14:11 Honza Horak <hhorak@redhat.com>
0 siblings, 1 reply; 4+ messages in thread
From: Honza Horak @ 2014-05-20 14:11 UTC (permalink / raw)
To: pgsql-bugs; +Cc: Bohuslav Kabrda <bkabrda@redhat.com>; Jozef Mlich <jmlich@redhat.com>
Hi guys,
Slavek is preparing Python 3.4 into Fedora and had some issues with
python3/plpython_do test. His analysis is below.
As for the fix, I'm not sure if the test suite is capable of being
flexible for such error messages, but if the purpose of the test was to
get any traceback, we might be fine with changing the error traceback to
e.g.
>>> raise Exception('error occurred')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
Exception: error occurred
If any assistance with testing or preparing a patch is required, just ask.
Regards,
Honza
-------- Original Message --------
Subject: postgresql test failure with Python 3.4.0 in plpython_do
Date: Tue, 20 May 2014 08:52:28 -0400 (EDT)
From: Bohuslav Kabrda <bkabrda@redhat.com>
To: Honza Horak <hhorak@redhat.com>
Diff of expected and actual result:
[bkabrda@zizalka plpython]$ diff -u expected/python3/plpython_do.out
results/python3/plpython_do.out
inline patch 1: results/python3/plpython_do.out (+1/-1 lines) download inline-1.patch
--- expected/python3/plpython_do.out 2014-05-20 14:09:44.118369434 +0200
+++ results/python3/plpython_do.out 2014-05-20 12:37:01.522028783 +0200
@@ -5,7 +5,7 @@
NOTICE: This is plpython2u.
CONTEXT: PL/Python anonymous code block
DO $$ nonsense $$ LANGUAGE plpython3u;
-ERROR: NameError: global name 'nonsense' is not defined
+ERROR: NameError: name 'nonsense' is not defined
CONTEXT: Traceback (most recent call last):
PL/Python anonymous code block, line 1, in <module>
nonsense
IIUC the plpython postgresql extension takes the Python code, creates a
function of it and then executes it. This is problem, since the error
message for undefined names *inside functions* (not for undefined names
on global level) has changed (fixed actually, the new version makes more
sense IMO) in Python 3.4 compared to 3.3.
An example, first Python 3.3:
Python 3.3.2 (default, Mar 5 2014, 08:21:05)
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo():
... nonsense
...
>>> foo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in foo
NameError: global name 'nonsense' is not defined
Now on Python 3.4:
Python 3.4.0 (default, May 18 2014, 22:59:00)
[GCC 4.9.0 20140514 (Red Hat 4.9.0-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo():
... nonsense
...
>>> foo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in foo
NameError: name 'nonsense' is not defined
Note that in Python 3.4, the "global" word is missing, which causes the
failure. Perhaps the result file could contain a regexp that would match
both or a python3.4 variant of the result could be added?
Slavek
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgresql test failure with Python 3.4.0 in plpython_do
@ 2014-05-28 08:07 Honza Horak <hhorak@redhat.com>
parent: Honza Horak <hhorak@redhat.com>
0 siblings, 1 reply; 4+ messages in thread
From: Honza Horak @ 2014-05-28 08:07 UTC (permalink / raw)
To: pgsql-bugs; +Cc: Bohuslav Kabrda <bkabrda@redhat.com>; Jozef Mlich <jmlich@redhat.com>
On 05/20/2014 04:11 PM, Honza Horak wrote:
> Hi guys,
>
> Slavek is preparing Python 3.4 into Fedora and had some issues with
> python3/plpython_do test. His analysis is below.
>
> As for the fix, I'm not sure if the test suite is capable of being
> flexible for such error messages, but if the purpose of the test was to
> get any traceback, we might be fine with changing the error traceback to
> e.g.
>
> >>> raise Exception('error occurred')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> Exception: error occurred
>
> If any assistance with testing or preparing a patch is required, just ask.
The patch for the fix as mentioned above is attached. In case it is a
correct fix, feel free to apply.
Regards,
Honza
> -------- Original Message --------
> Subject: postgresql test failure with Python 3.4.0 in plpython_do
> Date: Tue, 20 May 2014 08:52:28 -0400 (EDT)
> From: Bohuslav Kabrda <bkabrda@redhat.com>
> To: Honza Horak <hhorak@redhat.com>
>
> Diff of expected and actual result:
>
> [bkabrda@zizalka plpython]$ diff -u expected/python3/plpython_do.out
> results/python3/plpython_do.out
> --- expected/python3/plpython_do.out 2014-05-20 14:09:44.118369434 +0200
> +++ results/python3/plpython_do.out 2014-05-20 12:37:01.522028783 +0200
> @@ -5,7 +5,7 @@
> NOTICE: This is plpython2u.
> CONTEXT: PL/Python anonymous code block
> DO $$ nonsense $$ LANGUAGE plpython3u;
> -ERROR: NameError: global name 'nonsense' is not defined
> +ERROR: NameError: name 'nonsense' is not defined
> CONTEXT: Traceback (most recent call last):
> PL/Python anonymous code block, line 1, in <module>
> nonsense
>
>
> IIUC the plpython postgresql extension takes the Python code, creates a
> function of it and then executes it. This is problem, since the error
> message for undefined names *inside functions* (not for undefined names
> on global level) has changed (fixed actually, the new version makes more
> sense IMO) in Python 3.4 compared to 3.3.
> An example, first Python 3.3:
>
> Python 3.3.2 (default, Mar 5 2014, 08:21:05)
> [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> def foo():
> ... nonsense
> ...
>>>> foo()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "<stdin>", line 2, in foo
> NameError: global name 'nonsense' is not defined
>
>
>
> Now on Python 3.4:
>
> Python 3.4.0 (default, May 18 2014, 22:59:00)
> [GCC 4.9.0 20140514 (Red Hat 4.9.0-4)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> def foo():
> ... nonsense
> ...
>>>> foo()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "<stdin>", line 2, in foo
> NameError: name 'nonsense' is not defined
>
>
> Note that in Python 3.4, the "global" word is missing, which causes the
> failure. Perhaps the result file could contain a regexp that would match
> both or a python3.4 variant of the result could be added?
>
> Slavek
>
>
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Attachments:
postgresql-python34.patch (text/x-patch, 1.8K) download
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;
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgresql test failure with Python 3.4.0 in plpython_do
@ 2014-06-01 17:58 Tom Lane <tgl@sss.pgh.pa.us>
parent: Honza Horak <hhorak@redhat.com>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2014-06-01 17:58 UTC (permalink / raw)
To: Honza Horak <hhorak@redhat.com>; +Cc: pgsql-bugs; Bohuslav Kabrda <bkabrda@redhat.com>; Jozef Mlich <jmlich@redhat.com>
Honza Horak <hhorak@redhat.com> writes:
> On 05/20/2014 04:11 PM, Honza Horak wrote:
>> Slavek is preparing Python 3.4 into Fedora and had some issues with
>> python3/plpython_do test. His analysis is below.
> The patch for the fix as mentioned above is attached. In case it is a
> correct fix, feel free to apply.
Hi Honza! Sorry about the slow response on this --- everybody was at
PGCon last week, and I think this sort of slipped through the cracks.
On looking into the sources I see that Peter already fixed this issue,
in a way substantially the same as yours, but only in HEAD:
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=d0765d50f
I dunno why he didn't back-patch that, but I will see to it.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgresql test failure with Python 3.4.0 in plpython_do
@ 2014-06-02 08:42 Honza Horak <hhorak@redhat.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Honza Horak @ 2014-06-02 08:42 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs; Bohuslav Kabrda <bkabrda@redhat.com>; Jozef Mlich <jmlich@redhat.com>
On 06/01/2014 07:58 PM, Tom Lane wrote:
> Honza Horak <hhorak@redhat.com> writes:
>> On 05/20/2014 04:11 PM, Honza Horak wrote:
>>> Slavek is preparing Python 3.4 into Fedora and had some issues with
>>> python3/plpython_do test. His analysis is below.
>
>> The patch for the fix as mentioned above is attached. In case it is a
>> correct fix, feel free to apply.
>
> Hi Honza! Sorry about the slow response on this --- everybody was at
> PGCon last week, and I think this sort of slipped through the cracks.
No problem, I hope you enjoyed the PgCon.
> On looking into the sources I see that Peter already fixed this issue,
> in a way substantially the same as yours, but only in HEAD:
> http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=d0765d50f
> I dunno why he didn't back-patch that, but I will see to it.
Great, thanks a lot, Tom!
Honza
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2014-06-02 08:42 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-05-20 14:11 postgresql test failure with Python 3.4.0 in plpython_do Honza Horak <hhorak@redhat.com>
2014-05-28 08:07 ` Honza Horak <hhorak@redhat.com>
2014-06-01 17:58 ` Tom Lane <tgl@sss.pgh.pa.us>
2014-06-02 08:42 ` Honza Horak <hhorak@redhat.com>
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