Re: [PATCH] Fix conversion for Decimal arguments in plpython functions

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: Ronan Dunklau <rdunklau(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Fix conversion for Decimal arguments in plpython functions
Date: 2013-06-26 11:03:57
Message-ID: CAFjNrYuZW_1zPs1SJtJJAPSdnGZ=r4S7Ks4rE1yVa0-JVrHQMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 26 June 2013 12:04, Ronan Dunklau <rdunklau(at)gmail(dot)com> wrote:

> It seems like you confused me with steve :)
>
>
Hi Ronan,
Oh, yes. I'm sorry for that :)

> The patch applies cleanly, and the regression tests pass on python2 when
> cdecimal is not installed. When it is, the type info returned for the
> converted numeric value is cdecimal.Decimal instead of decimal.Decimal.
>
> The regression tests expected output have not been modified for python3,
> and as such they fail on the type conversions.
>
> I am a bit confused with the use of PyModule_GetDict: shouldn't
> PyObj_GetAttrString be used directly instead ? Moreover, the reference
> count in the current implementation might be off: the reference count for
> the decimal module is never decreased, while the reference count to the
> module dict is, when the docs say it returns a borrowed reference.
>
> Please find a patch that fixes both issues.
>
>
Thanks for the patch. I assume you generated that from clean trunk, and it
includes all the changes (mine and yours) right?

I've checked the patch, everything looks great.
I've attached it to this email with changed name, just for consistent
naming in commitfest app.

thanks,
Szymon

Attachment Content-Type Size
plpython_decimal_v4.patch application/octet-stream 9.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2013-06-26 11:08:20 Re: Bloom Filter lookup for hash joins
Previous Message Amit Kapila 2013-06-26 10:52:28 Re: Review: Patch to compute Max LSN of Data Pages