Re: Python 2.7 deprecated the PyCObject API?

From: James William Pye <lists(at)jwp(dot)name>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Python 2.7 deprecated the PyCObject API?
Date: 2010-08-14 02:16:27
Message-ID: 4A8655F9-54BC-44C0-BC90-575B1E536104@jwp.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Aug 13, 2010, at 5:20 PM, Tom Lane wrote:
> According to a discussion over in Fedora-land, $subject is true:
> http://lists.fedoraproject.org/pipermail/devel/2010-August/140995.html
>
> 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();

That is, with those warnings adjustments, proc->me will be NULL and then explode in PyDict_SetItemString:

[David Malcolm]
However, if someone overrides the process-wide warnings settings, then
the API can fail altogether, raising a PendingDeprecationWarning
exception (which in CPython terms means setting a thread-specific error
state and returning NULL).
./

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-14 02:19:58 Re: Re: [COMMITTERS] pgsql: Include the backend ID in the relpath of temporary relations.
Previous Message Greg Stark 2010-08-14 01:11:09 Re: "micro bucket sort" ...