[issue6363] __future__ statements break doctest

Poor Yorick report at bugs.python.org
Tue Jun 30 17:09:11 CEST 2009


Poor Yorick <pooryorick at users.sourceforge.net> added the comment:

here is a monkey patch to work around the problem:

import __future__
import doctest
if sys.version_info.major > 2:
        _extract_future_flags_old = doctest._extract_future_flags
        def _extract_future_flags(globs):
                flags = _extract_future_flags_old(globs)
                flags = flags & ~__future__.division.compiler_flag
                flags = flags & ~__future__.absolute_import.compiler_
                flags = flags & ~__future__.nested_scopes.compiler_fl
                flags = flags & ~__future__.print_function.compiler_f
                flags = flags & ~__future__.unicode_literals.compiler
                flags = flags & ~__future__.with_statement.compiler_f
                return flags
        doctest._extract_future_flags = _extract_future_flags

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6363>
_______________________________________


More information about the Python-bugs-list mailing list