forked from VimPlug/jedi
Fixed issue with repr encoding (fixes davidhalter/jedi-vim#94)
This commit is contained in:
@@ -182,3 +182,8 @@ try:
|
||||
except ImportError:
|
||||
# python 2.5
|
||||
import simplejson as json
|
||||
|
||||
try:
|
||||
encoding = sys.stdout.encoding
|
||||
except AttributeError:
|
||||
encoding = 'ascii'
|
||||
|
||||
@@ -68,7 +68,7 @@ backtracking algorithm.
|
||||
|
||||
.. todo:: nonlocal statement, needed or can be ignored? (py3k)
|
||||
"""
|
||||
from _compatibility import next, hasattr, is_py3k, unicode
|
||||
from _compatibility import next, hasattr, is_py3k, unicode, utf8
|
||||
|
||||
import sys
|
||||
import itertools
|
||||
|
||||
@@ -25,7 +25,7 @@ import re
|
||||
import tokenize
|
||||
|
||||
from _compatibility import next, literal_eval, cleandoc, Python3Method, \
|
||||
property
|
||||
property, encoding
|
||||
import common
|
||||
import debug
|
||||
|
||||
@@ -92,9 +92,8 @@ class Simple(Base):
|
||||
self._end_pos = value
|
||||
|
||||
def __repr__(self):
|
||||
code = self.get_code().replace('\n', ' ')
|
||||
return "<%s: %s@%s>" % \
|
||||
(type(self).__name__, code, self.start_pos[0])
|
||||
code = self.get_code().replace('\n', ' ').encode(encoding, 'replace')
|
||||
return '<%s: %s@%s>' % (type(self).__name__, code, self.start_pos[0])
|
||||
|
||||
|
||||
class Scope(Simple):
|
||||
|
||||
@@ -265,7 +265,7 @@ class TestRegression(TestBase):
|
||||
completions1 = self.complete(s1)
|
||||
assert 'strip' in [c.word for c in completions1]
|
||||
s2 = utf8('#-*- coding: utf-8 -*-\nclass Person():\n name = "é"\n\nPerson().name.')
|
||||
completions = self.complete(s2)
|
||||
completions2 = self.complete(s2)
|
||||
assert 'strip' in [c.word for c in completions2]
|
||||
|
||||
def test_os_nowait(self):
|
||||
|
||||
Reference in New Issue
Block a user