Issue #1350 closed

Drop 2to3 mechanism

Takayuki Shimizukawa
created an issue

There is some way to complete to drop 2to3.

(see also #1220 discussion)

Comments (33)

  1. Takayuki Shimizukawa reporter

    The python-future does not support Python-3.2 because py32 does not support unicode literal. They said Adding support for Python 3.2 to future would likely impose a penalty with performance and/or maintainability,.. (see also python-future FAQ).

    I think we need to decide whether drop Python-3.2 or not. If we decided to drop py32, we may not need to be dependent on six/future.

  2. Georg Brandl repo owner

    For that it would be nice to know what python-future offers on top of six, and if it's worth using it. If yes, I'm not opposed to requiring Python 3.3.

  3. Georg Brandl repo owner

    I've just finished porting Pygments to single-source, and I have two observations:

    • python-future's conversion tool is nice, but otherwise I prefer six: less magic. future even reimplements the "int" type which is definitely too much compatibility.

    • The u"" literal from Python 3.3+ is not definitely needed; modules with many literals can use from __future__ import unicode_literals while others can use a u() wrapper. For Pygments, I did not use unicode_literals since it pretty much changes all lexers. Therefore I require 3.3+ there.

  4. Dmitry Shachnev

    I have just created pull request #208 for the first part of refactoring. Please review it carefully, I may have missed some bugs.

    I have a question about tests/etree13. Is it still needed? Can we use xml.etree.ElementTree instead (which is available in Python 2.5+)?

  5. Dmitry Shachnev

    Re etree13, the tests work with Python 2 but not Python 3, I get lots of failures like this one:

    FAIL: test_build_html.test_html(<xml.etree.ElementTree.ElementTree object at 0xb5f2f3ec>, 'subdir/includes.html', ".//a[@href='../_downloads/img.png']", '')
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/nose/", line 198, in runTest
      File "/home/dmitry/sphinx-hg/sphinx/build/lib/tests/", line 302, in check_xpath
        '%r in file %s' % (path, fname))
    AssertionError: did not find any node matching xpath ".//a[@href='../_downloads/img.png']" in file subdir/includes.html
  6. Takayuki Shimizukawa reporter

    I got a reason why py3 test has been failed.

    Python 3 imports compiled version ElementTree and XMLParser automatically. On the other hand, in Python 2, ElementTree and cElementTree is divided explicitly.

    And compiled XMLParser doesn't have _fixname method then subclass can't override it.

    I'm going to introduce tests/ that has a full copy of the python version XMLParser. I think it will resolve this problem.

  7. Takayuki Shimizukawa reporter
    • Drop Python-3.2. And now, removing 2to3 mechanism procedure has been completed. Closes #1350.

    Pygments-2.0 will drop Python-3.2. The snowballstemmer package that is referred from sphinx-1.3 (that is merged at pull request #214) has not supported Python-3.2.

    We decided to drop the Python-3.2.

    see also

    → <<cset b1ea75bf34d4>>

  8. Log in to comment