[Python-Dev] Making PyInterpreterState an opaque type

Paul Moore p.f.moore at gmail.com
Thu Feb 21 06:58:00 EST 2019


On Thu, 21 Feb 2019 at 11:35, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
> On Thu, 21 Feb 2019 12:13:51 +0100
> Victor Stinner <vstinner at redhat.com> wrote:
> >
> > Premature optimization is the root of all evil. Most C extensions use
> > premature optimization
>
> How do you know it's premature?  Some extensions _are_ meant for speed.

Extensions that need to squeeze every bit of speed out of the C API
are the exception rather than the rule. Making it easier for extension
authors to naturally pick portable options seems reasonable to me.
Gating the "fast, but unsafe" APIs behind some sort of "opt in"
setting seems like a sensible approach.

However I agree, making it *impossible* to get right down to the
high-speed calls (with the understanding that you're typing yourself
to CPython and need to carefully track internal changes) is not
something we should do. Python's built an ecosystem around
high-performance C extensions, and we should support that ecosystem.

Paul


More information about the Python-Dev mailing list