Re: Python 2.7 deprecated the PyCObject API?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Python 2.7 deprecated the PyCObject API?
Дата
Msg-id 29560.1281802121@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Python 2.7 deprecated the PyCObject API?  (James William Pye <lists@jwp.name>)
Ответы Re: Python 2.7 deprecated the PyCObject API?  (James William Pye <lists@jwp.name>)
Список pgsql-hackers
James William Pye <lists@jwp.name> writes:
> On Aug 13, 2010, at 5:20 PM, Tom Lane wrote:
>> I see several calls in plpython.c that seem to refer to PyCObject stuff.
>> Anybody have any idea if we need to do something about this?

> Well, we should at least be checking for an exception here anyways:

>         proc->me = PyCObject_FromVoidPtr(proc, NULL);
>         PyDict_SetItemString(PLy_procedure_cache, key, proc->me);

> if (proc->me == NULL) complain();

Just to clarify, you're recommending something like
    proc->me = PyCObject_FromVoidPtr(proc, NULL);
+        if (proc->me == NULL)
+            elog(ERROR, "could not create PyCObject for function");    PyDict_SetItemString(PLy_procedure_cache, key,
proc->me);

correct?  (Hm, and it looks like we'd better move the pfree just above that...)

> AFA a better fix is concerned, the shortest route would seem to be to
> use the new capsule stuff iff Python >= 2.7.

Yeah, and since we'll have to back-patch it, a fairly noninvasive patch
would be nice.  Will you work on that?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #5608: array_agg() consumes too much memory
Следующее
От: James William Pye
Дата:
Сообщение: Re: Python 2.7 deprecated the PyCObject API?