Re: Python 2.7 deprecated the PyCObject API?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: James William Pye <lists@jwp.name>
Cc: pgsql-hackers@postgresql.org
Date: 2010-08-15T18:25:03Z
Lists: pgsql-hackers
James William Pye <lists@jwp.name> writes:
> On Aug 14, 2010, at 9:08 AM, Tom Lane wrote:
>> 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...)

> Almost, there's still a Python exception to report and/or clear.

Ah, right, I guess that should be PLy_elog() not just elog().

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

> I was hoping that Peter would pop in with a patch, but I think a few lines of CPP may suffice..
> ...
> yay? nay?

Damifino, I don't hack Python.  Peter?

			regards, tom lane