16
16
# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
17
17
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18
18
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
- import __future__
20
19
21
20
from __future__ import annotations
22
21
@@ -161,17 +160,6 @@ def __init__(
161
160
) -> None :
162
161
super ().__init__ (locals = locals , filename = filename , local_exit = local_exit ) # type: ignore[call-arg]
163
162
self .can_colorize = _colorize .can_colorize ()
164
- self .barry_as_FLUFL = False
165
-
166
- def check_barry_as_FLUFL (self , tree ):
167
- if self .barry_as_FLUFL :
168
- return
169
- for node in ast .walk (tree ):
170
- if isinstance (node , ast .ImportFrom ) and node .module == "__future__" :
171
- if any (alias .name == "barry_as_FLUFL" for alias in node .names ):
172
- self .compile .compiler .flags |= getattr (__future__ , "barry_as_FLUFL" ).compiler_flag
173
- self .barry_as_FLUFL = True
174
- break
175
163
176
164
def showsyntaxerror (self , filename = None , ** kwargs ):
177
165
super ().showsyntaxerror (filename = filename , ** kwargs )
@@ -186,8 +174,7 @@ def _excepthook(self, typ, value, tb):
186
174
187
175
def runsource (self , source , filename = "<input>" , symbol = "single" ):
188
176
try :
189
- tree = ast .parse (source )
190
- self .check_barry_as_FLUFL (tree )
177
+ tree = self .compile .compiler (source , filename , symbol , ast .PyCF_ONLY_AST )
191
178
except (SyntaxError , OverflowError , ValueError ):
192
179
self .showsyntaxerror (filename , source = source )
193
180
return False
0 commit comments