1
0
forked from VimPlug/jedi

The encoding parameter should be used again (includes test), fixes #1167

This commit is contained in:
Dave Halter
2018-07-09 18:25:28 +02:00
parent aa4dcc1631
commit cef769ecd8
3 changed files with 10 additions and 3 deletions

View File

@@ -373,12 +373,12 @@ class Evaluator(object):
scope_node = parent_scope(node)
return from_scope_node(scope_node, is_nested=True, node_is_object=node_is_object)
def parse_and_get_code(self, code=None, path=None, **kwargs):
def parse_and_get_code(self, code=None, path=None, encoding='utf-8', **kwargs):
if self.allow_different_encoding:
if code is None:
with open(path, 'rb') as f:
code = f.read()
code = python_bytes_to_unicode(code, errors='replace')
code = python_bytes_to_unicode(code, encoding=encoding, errors='replace')
return self.grammar.parse(code=code, path=path, **kwargs), code