[Python-Dev] API deprecations in Python 3, from a Python 2 perspective

Nick Coghlan ncoghlan at gmail.com
Sat Mar 19 03:42:54 CET 2011


On Fri, Mar 18, 2011 at 1:04 AM, Guido van Rossum <guido at python.org> wrote:
> I don't want to be alarmist and I don't want to start another
> moratorium, but I do think that we need to be aware of people coming
> in "sideways" into Python 3 and missing the nice deprecations. So
> let's be conservative with deprecations in the Python 3 line for now.

Adding new deprecations is probably OK, but we should definitely be
very cautious about following through with *removal* of deprecated
items.

I was pondering the specific case of PyCapsule on the way home, and it
actually took quite a series of events for it to blow up in Lennart's
face the way it did at the sprints:

1. We really should have made a PEP about it at the time, but that
didn't occur to anyone involved in the decision (I have vague
recollections of contributing to those discussions, so I suspect a
piece of the blame for that ends up in my own lap).

2. I believe PyCObject jumped directly from a
PendingDeprecationWarning in 3.1 to removal in 3.2. That would have
been less likely if we'd written a PEP to clearly spell out the
deprecation timeline.

3. For whatever reason, nobody objected to the removal during post hoc
python-checkins review. (While that manual filter catches a lot of
mistakes, things can definitely slip through).

4. Anyone testing C extensions against the 3.2 alpha and beta releases
must have either not used the PyCObject API in the first place, or
else had already ported their code to use the PyCapsule API as
necessary.

5. The parallel evolution of the 2.x and 3.x line meant that the first
version of 2.x with the relevant warning was released only ~7 months
or so before the version of 3.2 where the API was removed

Backfilling with an after-the-fact PEP (as Larry now plans to do) will
help make sure this particular change is less likely to come as a
nasty surprise to anyone else, and will provide concrete porting
advice for those that need to maintain compatibility with older Python
versions that only offer the PyCObject API.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list