__future__ and compile: unrecognised flags
org.python.pythonlist at pooryorick.com
Sat Dec 13 12:29:17 CET 2008
I have a future statement in a script which is intended to work in 2.6 and 3.
Shouldn't compile flags in __future__ objects essentially be noops for versions
that already support the feature? doctest is complaining about unrecognised
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