Don't use python_version directly on evaluator anymore

This commit is contained in:
Dave Halter
2017-12-28 01:44:59 +01:00
parent 31f1913b07
commit 6b6795c40c
3 changed files with 5 additions and 4 deletions

View File

@@ -62,8 +62,6 @@ only *evaluates* what needs to be *evaluated*. All the statements and modules
that are not used are just being ignored. that are not used are just being ignored.
""" """
import sys
from parso.python import tree from parso.python import tree
import parso import parso
@@ -104,7 +102,6 @@ class Evaluator(object):
self.analysis = [] self.analysis = []
self.dynamic_params_depth = 0 self.dynamic_params_depth = 0
self.is_analysis = False self.is_analysis = False
self.python_version = sys.version_info[:2]
self.project = project self.project = project
self.access_cache = {} self.access_cache = {}
project.add_evaluator(self) project.add_evaluator(self)

View File

@@ -300,4 +300,8 @@ class AccessHandle(object):
@memoize_method @memoize_method
def _cached_results(self, name, *args, **kwargs): def _cached_results(self, name, *args, **kwargs):
if type(self._subprocess) == EvaluatorSubprocess:
print(name, args, kwargs,
self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs)
)
return self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs) return self._subprocess.get_compiled_method_return(self.id, name, *args, **kwargs)

View File

@@ -136,7 +136,7 @@ def builtins_next(evaluator, iterators, defaults):
TODO this function is currently not used. It's a stab at implementing next TODO this function is currently not used. It's a stab at implementing next
in a different way than fake objects. This would be a bit more flexible. in a different way than fake objects. This would be a bit more flexible.
""" """
if evaluator.python_version[0] == 2: if evaluator.environment.version_info.major == 2:
name = 'next' name = 'next'
else: else:
name = '__next__' name = '__next__'