[Python-Dev] RFC: PEP 587 "Python Initialization Configuration": 3rd version

Paul Moore p.f.moore at gmail.com
Thu May 16 09:30:37 EDT 2019

On Thu, 16 May 2019 at 13:05, Victor Stinner <vstinner at redhat.com> wrote:
> > PyPreConfig_INIT and PyConfig_INIT as macros that return a struct feel
> > weird to me. Specifically, the `PyPreConfig preconfig =
> > PyPreConfig_INIT;` pattern doesn't feel right. I'm sort of OK with these
> > being implemented as macros. But I think they should look like function
> > calls so the door is open to converting them to function calls in the
> > future.
> Ah yes, I noticed that some projects can only import symbols, not use
> directly the C API. You're right that such macro can be an issue.

I've not been following this PEP particularly, but I can confirm that
the Vim bindings for Python also have this restriction (at least on
Windows). To allow binding to the Python interpreter at runtime, and
only on demand, the interface does an explicit
LoadLibrary/GetProcAddress call for each C API function that's used.
That means macros are unavailable (short of wholesale copying of the
Python headers). (It's also a painfully laborious bit of code, and it
would be nice if there were a better way of doing it, but I've never
had the time/motivation to try to improve this, so that's just how
it's stayed).


More information about the Python-Dev mailing list