[Python-Dev] Making PyInterpreterState an opaque type

Eric Snow ericsnowcurrently at gmail.com
Mon Feb 18 14:25:40 EST 2019


On Sat, Feb 16, 2019 at 3:34 PM Steve Dower <steve.dower at python.org> wrote:
> On 16Feb.2019 1332, Antoine Pitrou wrote:
> > This sounds like a reasonable design principle: decree the API
> > non-stable and prone to breakage (it already is, anyway), don't hide it.
>
> As I was chatting with Eric shortly before he posted this, I assume the
> idea would be to expose anything useful/necessary via a function. That
> at least removes the struct layout from the ABI, without removing
> functionality.
>
> > It's true that in the PyInterpreterState case specifically, there
> > doesn't seem much worthy of use by third-party libraries.
>
> Which seems to suggest that the answer to "which members are important
> to expose?" is "probably none". And that's possibly why Eric didn't
> mention it in his email :)
>
> This is mostly about being able to assign blame when things break, so
> I'm totally okay with extension modules that want to play with internals
> declaring Py_BUILD_CORE to get access to them (though I suspect that
> won't work out of the box - maybe we should have a
> Py_I_TOO_LIKE_TO_LIVE_DANGEROUSLY?).
>
> I like that we're taking (small) steps to reduce the size of our API. It
> helps balance out the growth and leaves us with a chance of one day
> being able to have an extension model that isn't as tied to C's ABI.

Yeah, what Steve said. :)

-eric


More information about the Python-Dev mailing list