Re: PL/Python result set slicing broken in Python 3

From: Jan Urbański <wulczer(at)wulczer(dot)org>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/Python result set slicing broken in Python 3
Date: 2012-05-04 18:00:55
Message-ID: 4FA41957.3040502@wulczer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/05/12 11:04, Jan Urbański wrote:
> On 02/05/12 20:18, Peter Eisentraut wrote:
>> This doesn't work anymore with Python 3:
>>
>> rv = plpy.execute(...)
>> do_something(rv[0:1])
>>
>> Apparently, they changed the C API for doing slicing, or rather made one
>> of the two APIs for it silently do nothing. Details are difficult to
>> find, but this email message seems to contain something:
>> <http://mail.python.org/pipermail/python-3000/2007-August/009851.html>.
>>
>> I'll try to sort this out sometime, but if someone wants to take a shot
>> at it, go ahead.
>
> Sounds ugly. I'll take a look.

I found some instructions on how to deal with the Python 2/Python 3
slicing mess:

http://renesd.blogspot.com/2009/07/python3-c-api-simple-slicing-sqslice.html

Apparently you need that egregious hack in order to avoid code
duplication. I'll try to produce a patch over the weekend.

Cheers,
Jan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2012-05-04 19:44:54 Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ?
Previous Message Peter Eisentraut 2012-05-04 17:46:28 Re: Uppercase tab completion keywords in psql?