| 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-05 20:45:15 |
| Message-ID: | 4FA5915B.4010809@wulczer.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 04/05/12 20:00, Jan Urbański wrote:
> 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])
>>>
>> 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
Thanks to the helpful folk at #python I found out that the fix is much
easier. Attached is a patch that fixes the bug and passes regression
tests on Pythons 2.3 through 3.2.
Apparently once you implement PyMappingMethods.mp_subscript you can drop
PySequenceMethods.sq_slice, but I guess there's no harm in keeping it
(and I'm not sure it'd work on Python 2.3 with only mp_subscript
implemented).
Do we want to backpatch this? If so, I'd need to produce a version that
applies to the monolithic plpython.c file from the previous releases.
Cheers,
Jan
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-slicing-support-for-result-objects-for-Python-3.patch | text/x-diff | 0 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2012-05-06 00:06:49 | Re: remove dead ports? |
| Previous Message | Bruce Momjian | 2012-05-05 16:44:14 | Re: remove dead ports? |