[Python-Dev] Handling deprecations in the face of PEP 384

Brett Cannon brett at python.org
Sun Apr 22 03:13:50 CEST 2012

On Sat, Apr 21, 2012 at 20:54, Eric Snow <ericsnowcurrently at gmail.com>wrote:

> On Sat, Apr 21, 2012 at 4:17 PM, Brett Cannon <brett at python.org> wrote:
> > On Sat, Apr 21, 2012 at 12:10, Barry Warsaw <barry at python.org> wrote:
> >> Strictly speaking, I do think you need to deprecate the APIs.  I like
> >> Nick's
> >> suggestion to make them C wrappers which just call back into Python.
> >
> >
> > That was my plan, but the amount of code it will take to wrap them is
> making
> > me not care. =) For PyImport_GetMagicTag() I would need to expose a new
> > attribute on sys or somewhere which specifies the VM name. For
> > PyImport_GetMagicNumber() I have to do a bunch of bit twiddling to
> convert a
> > bytes object into a long which I am just flat-out not in the mood to
> figure
> > out how to do. And all of this will lead to the same amount of C code as
> > there currently is for what is already implemented, so I just don't care
> > anymore. =)
> I thought I already (mostly) worked it all out in that patch on
> issue13959.  I felt really good about the approach for the magic tag
> and magic bytes.

You didn't update Python/import.c in your patches so that the public C API
continued to function. That's what is going to take a bunch of C code to
continue to maintain, not the Python side of it.

> Once find_module() and reload() are done in imp.py, I'm hoping to
> follow up on a few things.  That includes the unresolved mailing list
> thread about sys.implementation (or whatever it was), which will help
> with the magic tag.  Anyway, I don't want to curtail the gutting of
> import.c quite yet (as he hears cries of "bring out your dead!").

Even w/ all of that gutted, a decent chunk of coding is holding on to dear
life thanks to PyImport_ExecCodeModuleObject() (and those that call it).
IOW the C API as it is currently exposed is going to end up being the
limiting factor of how many lines get deleted in the very end.

> -eric
> p.s.  I understand your sentiment here, considering that mothers are
> often exhausted by childbirth and the importlib bootstrap was a big
> baby.  You were in labor for, what, 6 years.  <wink>  [There's an
> analogy that could keep on giving. :) ]

It's also about maintainability. It isn't worth upping complexity just to
shift some stuff into Python code, especially when it is such simple stuff
as the magic number and tag which places practically zero burden on other
VMs to implement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120421/6d11aab3/attachment.html>

More information about the Python-Dev mailing list