PostgreSQL working on moving to C "Limited API"

Wanted to raise here for visibility, PostgreSQL for their PL/Python extension have been trying to move to the Limited C API:

Patch development: PostgreSQL: Use Python "Limited API" in PL/Python
Recent difficulties: PostgreSQL: pgsql: Prepare for Python "Limited API" in PL/Python

In particular they’re looking for help with difficulties encountered in older Python versions they need to support

3 Likes

I’m reluctant to review something in detail here when I suspect it should really go to their mailing list. However, some of their problems are that PyObject_Free is not equivalent to arg->ob_type->tp_free(arg);. Instead they want ((freefunc)PyType_GetSlot(tp, Py_tp_free))(arg) or something similar.

More generally, I’d advise them but to worry excessively about covering all Python versions with the Limited API - start at the first one they find is easily usable.

3 Likes