The Python Software Foundation has released the second release candidate (RC) of Python 3.9 and is warning users to watch for deprecation warnings as it drops backward compatibility for unsupported Python 2.7.
Python maintainers stopped supporting Python 2.7 this April, some five years after support was originally meant to end – and 12 years after Python creator Guido van Rossum announced Python 3.
The main highlight from Python 3.9 RC2 is that it removes most backward-compatibility layers for Python 2.7. Python 3.8 had those layers; however, it was released in October 2019 when Python 2.7 remained supported.
SEE: Hiring Kit: Python developer (TechRepublic Premium)
The final version of Python 3.9 is scheduled for release in early October, so Python maintainers believe it makes sense to remove the 2.7 compatibility layers.
“When Python 2.7 was still supported, many functions were kept for backward compatibility with Python 2.7. With the end of Python 2.7 support, these backward-compatibility layers have been removed, or will be removed soon,” the Python Software Foundation notes.
As explained, even while backward compatibility with Python 2.7 has been available until now, compatibility layers have been emitting a “DeprecationWarning” warning for several years.
Despite the majority of compatibility layers vanishing in Python 3.9, it’s been decided to make a few exceptions for some 2.7 compatibility laters to support Python projects maintainers, so that they have time to remove Python 2 support and add support for Python 3.9.
The move to retain some compatibility layers follows concerns raised by RedHat-backed Python maintainer Victor Stinner, who maintains upstream Python and downstream Python for Red Hat Enterprise Linux (RHEL) and Fedora.
Stinner and and fellow RedHat engineer Miro Hrončok in January warned that there are over 150 Fedora packages broken by Python 3.9 because of deprecated 2.7 compatibility features being dropped. Fedora 33 is expected to be a huge release and is scheduled to be released around mid-October.
SEE: Project management: Four ways CTOs can make a difference
“Miro and me consider that Python 3.9 is pushing too much pressure on projects maintainers to either abandon Python 2.7 right now (need to update the CI, the documentation, warn users, etc.), or to introduce a new compatibility layer to support Python 3.9: layer which would be dropped as soon as Python 2.7 support will be dropped (soon-ish),” wrote Stinner.
Python maintainers have, therefore, kept a few key 2.7 compatibility layers that will now be removed in the next release, Python 3.10.
“Aliases to Abstract Base Classes in the collections module, like collections.Mapping alias to collections.abc.Mapping, are kept for one last release for backward compatibility. They will be removed from Python 3.10,” the Python Software Foundation notes.