__future__ and compile: unrecognised flags

Discussion in 'Python' started by Poor Yorick, Dec 13, 2008.

  1. Poor Yorick

    Poor Yorick Guest

    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
    32
    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

    --
    Yorick
    Poor Yorick, Dec 13, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. red floyd
    Replies:
    0
    Views:
    400
    red floyd
    Aug 4, 2005
  2. Poor Yorick

    __future__ and unrecognised flags

    Poor Yorick, Dec 12, 2008, in forum: Python
    Replies:
    0
    Views:
    255
    Poor Yorick
    Dec 12, 2008
  3. Steve Holden
    Replies:
    1
    Views:
    387
    Rhamphoryncus
    Dec 14, 2008
  4. Steve Holden
    Replies:
    0
    Views:
    774
    Steve Holden
    Feb 8, 2009
  5. dhyams
    Replies:
    7
    Views:
    113
    Neil Cerutti
    Jun 12, 2013
Loading...

Share This Page