Mercurial Migration to Python 3 May Lead to Bugs

The Mercurial version control system maintainer summarized the work of translating the project from Python 2 to Python 3. Despite the fact that the first porting attempts were made back in 2008, and in forced mode, adaptation for working with Python 3 began in 2015, a full feature Python 3 was only implemented in the latest Mercurial 5.2 branch.

Forecasts for Python 3 port are disappointing. In particular, it is assumed that for several years random errors will pop up in the code, since the tests do not cover 100% of the code base, and many problems are invisible during static analysis and appear only at runtime. In addition, many third-party add-ons and extensions remain untranslated into Python 3. Since when porting it was decided to gradually adapt the code to Python 3, while maintaining support for Python 2, the code was overgrown with a lot of hacks to combine Python 2 and 3, which after the termination of support for Python 2 will have to be cleaned up.

Commenting on the situation with Python 3, Mercurial maintainer believes that the decision to promote Python 3 breaking compatibility and imposing it as a new, more correct language, in the absence of breakthrough improvements relevant to developers, was a big mistake that caused great harm to the community and is an example of how not need to do large projects. Instead of gradually increasing functionality and providing the possibility of incremental adaptation of applications, with the release of Python 3 developers were forced to rewrite the code and spend resources on maintaining separate branches for Python 2 and Python 3. Only seven years after the release of Python 3.0 in Python 3.5 were implemented features that allowed smoothing transition process and ensure the operation of one code base with Python 2 and Python 3.

Get more at the blog of one of the member of the project’s govermance group since 2014 Gregory Szorc.