1616# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
1717# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1818# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19- import __future__
2019
2120from __future__ import annotations
2221
@@ -161,17 +160,6 @@ def __init__(
161160 ) -> None :
162161 super ().__init__ (locals = locals , filename = filename , local_exit = local_exit ) # type: ignore[call-arg]
163162 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
175163
176164 def showsyntaxerror (self , filename = None , ** kwargs ):
177165 super ().showsyntaxerror (filename = filename , ** kwargs )
@@ -186,8 +174,7 @@ def _excepthook(self, typ, value, tb):
186174
187175 def runsource (self , source , filename = "<input>" , symbol = "single" ):
188176 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 )
191178 except (SyntaxError , OverflowError , ValueError ):
192179 self .showsyntaxerror (filename , source = source )
193180 return False
0 commit comments