pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Honza Horak <hhorak@redhat.com>
To: pgsql-bugs@postgresql.org
Cc: Bohuslav Kabrda <bkabrda@redhat.com>
Cc: Jozef Mlich <jmlich@redhat.com>
Subject: postgresql test failure with Python 3.4.0 in plpython_do
Date: Tue, 20 May 2014 16:11:15 +0200
Message-ID: <537B6283.90501@redhat.com> (raw)
In-Reply-To: <1509291848.14235127.1400590348512.JavaMail.zimbra@redhat.com>
References: <1509291848.14235127.1400590348512.JavaMail.zimbra@redhat.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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

view thread (4+ messages)  latest in thread

Message-ID: <537B6283.90501@redhat.com>
Permalink:  ../537B6283.90501@redhat.com/
Also on:    postgresql.org/message-id/537B6283.90501@redhat.com

 ·  · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hhorak@redhat.com, bkabrda@redhat.com, jmlich@redhat.com
  Subject: Re: postgresql test failure with Python 3.4.0 in plpython_do
  In-Reply-To: <537B6283.90501@redhat.com>
  References: <1509291848.14235127.1400590348512.JavaMail.zimbra@redhat.com> <537B6283.90501@redhat.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