exceptions not present in plpy with Python 3

From: Jan Urbański <wulczer(at)wulczer(dot)org>
To: Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: exceptions not present in plpy with Python 3
Date: 2010-12-18 17:56:29
Message-ID: 4D0CF5CD.4040301@wulczer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

there seems to be a problem in the way we add exceptions to the plpy
module in PL/Python compiled with Python 3k.

Try this: DO $$ plpy.SPIError $$ language plpython3u;

I'm not a Python 3 expert, but I nicked some code from the Internet and
came up with this patch (passes regression tests on both Python 2 and 3).

The funny thing is that it never blew up earlier, because we only used
plpy.SPIError in except: blocks that weren't even executed, as errors in
plpy.execute just terminate the function.

With my changes they turn into catchable exceptions, and so accessing
plpy.SPIError in Python 3 becomes essential.

BTW: do we have any buildfarm animal that uses Python 3?

Cheers,
Jan

Attachment Content-Type Size
plpython3-exceptions.diff text/x-patch 4.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2010-12-18 18:22:07 pg_ctl and port number detection
Previous Message Dimitri Fontaine 2010-12-18 17:41:04 Re: Extensions, patch v19 (encoding brainfart fix)