__future__ and unrecognised flags

Poor Yorick org.python.python-list at pooryorick.com
Fri Dec 12 22:52:52 CET 2008

I have a future statement in a script I intend to work on 2.6 and 3.  Shouldn't __future__ statements basically be noops for versions that already support the feature? doctest is complaining about compiler flags.  This illustrates the problem:

    Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] on win
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from __future__ import unicode_literals
    >>> src = 'a = "hello"'
    >>> c1 = compile(src,'<string>','exec',unicode_literals.compiler_flag)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: compile(): unrecognised flags


More information about the Python-list mailing list