From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | Jan Urbański <wulczer(at)wulczer(dot)org> |
Cc: | Eric Snow <esnow(at)verio(dot)net>, psycopg(at)postgresql(dot)org |
Subject: | Re: SystemError: null argument to internal routine |
Date: | 2011-03-03 20:32:06 |
Message-ID: | AANLkTinVCk0H14edbCwdNvt+fyKRvnNb=i5Ls_73kfo+@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On Thu, Mar 3, 2011 at 8:02 PM, Jan Urbański <wulczer(at)wulczer(dot)org> wrote:
> On 03/03/11 20:52, Eric Snow wrote:
>> I am trying to figure out the conditions under which I get that
>> SystemError. Here is a simple way that I found to reproduce the
>> problem:
>>
>>>>> import psycopg2
>>>>> psycopg2.__version__
>> '2.3.2 (dt dec pq3 ext)'
>>>>> conn = psycopg2.connect("...")
>>>>> cur = conn.cursor()
>>>>> cur.execute(";")
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> SystemError: null argument to internal routine
>>
>> I am getting the same exception during a call to copy_expert. How would
>> the data I pass in there trigger the same exception as when I pass a
>> single semicolon? I am guessing that it does not even make it over the
>> wire to the postgres server when the exception is raised. Thanks.
>
> Aaah, that rings a bell. I was getting the same error with txpostgres
> and even once found out why, but forgot, and now I remembered.
>
> I believe that the problem is in pqpath.c, in pq_fetch. There's a switch
> statement there that checks the result of PQresultStatus and does not
> take PGRES_EMPTY_QUERY into consideration.
>
> The code that jumps to the default: label, which leads it to pq_raise.
> Towards the end there's a
>
> if (code != NULL)
> exc = exception_from_sqlstate(code);
>
> which AFAIR never gets executed, because code *is* NULL. And then it
> hits psyco_set_error with a NULL exception, this leads to the "NULL
> argument to internal routine" error.
>
> I might have messed up some details, but I'm pretty sure the problem is
> not handling PGRES_EMPTY_QUERY correctly.
Thank you for the report: open ticket #46
<http://psycopg.lighthouseapp.com/projects/62710-psycopg/tickets/46>
If anyone wants to try to solve it, please add a comment to the
tracker. Otherwise I will take a look at it as soon as I have a
moment.
-- Daniele
From | Date | Subject | |
---|---|---|---|
Next Message | Eric Snow | 2011-03-04 00:03:36 | Re: SystemError: null argument to internal routine |
Previous Message | Jan Urbański | 2011-03-03 20:02:01 | Re: SystemError: null argument to internal routine |