mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-30 21:35:22 +08:00
Fix isues with Python 2.7 running a 3.6 env
This commit is contained in:
@@ -151,16 +151,16 @@ class Evaluator(object):
|
||||
@property
|
||||
@evaluator_function_cache()
|
||||
def builtins_module(self):
|
||||
module_name = 'builtins'
|
||||
module_name = u'builtins'
|
||||
if self.environment.version_info.major == 2:
|
||||
module_name = '__builtin__'
|
||||
module_name = u'__builtin__'
|
||||
builtins_module, = self.import_module((module_name,), sys_path=())
|
||||
return builtins_module
|
||||
|
||||
@property
|
||||
@evaluator_function_cache()
|
||||
def typing_module(self):
|
||||
typing_module, = self.import_module(('typing',))
|
||||
typing_module, = self.import_module((u'typing',))
|
||||
return typing_module.stub_context
|
||||
|
||||
def reset_recursion_limitations(self):
|
||||
|
||||
@@ -520,7 +520,7 @@ def _eval_comparison_part(evaluator, context, left, operator, right):
|
||||
message % (left, right))
|
||||
|
||||
result = ContextSet([left, right])
|
||||
debug.dbg('Used operator %s resulting in %s', result)
|
||||
debug.dbg('Used operator %s resulting in %s', operator, result)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ def test_simple(evaluator, environment):
|
||||
|
||||
def test_builtin_loading(evaluator):
|
||||
string, = evaluator.builtins_module.py__getattribute__(u'str')
|
||||
from_name, = string.py__getattribute__('__init__')
|
||||
from_name, = string.py__getattribute__(u'__init__')
|
||||
assert from_name.tree_node
|
||||
assert from_name.py__doc__()
|
||||
|
||||
@@ -48,7 +48,7 @@ def test_doc(evaluator):
|
||||
"""
|
||||
str_ = compiled.create_simple_object(evaluator, u'')
|
||||
# Equals `''.__getnewargs__`
|
||||
obj, = str_.py__getattribute__('__getnewargs__')
|
||||
obj, = str_.py__getattribute__(u'__getnewargs__')
|
||||
assert obj.py__doc__() == ''
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user