[pypy-commit] pypy py3k: Remove the "from __future__ import xyz" from the app-level helpers: it
arigo
pypy.commits at gmail.com
Sat Aug 20 03:47:13 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: py3k
Changeset: r86337:99c145db7090
Date: 2016-08-20 09:39 +0200
http://bitbucket.org/pypy/pypy/changeset/99c145db7090/
Log: Remove the "from __future__ import xyz" from the app-level helpers:
it has no effect any more, and it loads the world by using importlib
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -1167,15 +1167,15 @@
source = source[source.find('\n') + 1:].lstrip()
assert source.startswith("def "), "can only transform functions"
source = source[4:]
- import __future__
- if flags & __future__.CO_FUTURE_DIVISION:
- prefix += "from __future__ import division\n"
- if flags & __future__.CO_FUTURE_ABSOLUTE_IMPORT:
- prefix += "from __future__ import absolute_import\n"
- if flags & __future__.CO_FUTURE_PRINT_FUNCTION:
- prefix += "from __future__ import print_function\n"
- if flags & __future__.CO_FUTURE_UNICODE_LITERALS:
- prefix += "from __future__ import unicode_literals\n"
+ # The following flags have no effect any more in app-level code
+ # (i.e. they are always on anyway), and have been removed:
+ # CO_FUTURE_DIVISION
+ # CO_FUTURE_ABSOLUTE_IMPORT
+ # CO_FUTURE_PRINT_FUNCTION
+ # CO_FUTURE_UNICODE_LITERALS
+ # Original code was, for each of these flags:
+ # if flags & __future__.CO_xxx:
+ # prefix += "from __future__ import yyy\n"
p = source.find('(')
assert p >= 0
funcname = source[:p].strip()
More information about the pypy-commit
mailing list