1
0
forked from VimPlug/jedi

More unicode conversions

This commit is contained in:
Dave Halter
2017-12-24 03:35:15 +01:00
parent a117f9f2e7
commit 40f1354f67
4 changed files with 7 additions and 8 deletions

View File

@@ -242,8 +242,7 @@ def cast_path(obj):
Since this just really complicates everything and Python 2.7 will be EOL Since this just really complicates everything and Python 2.7 will be EOL
soon anyway, just go with always strings. soon anyway, just go with always strings.
""" """
return unicode(obj, encoding='utf-8', errors='replace') \ return u(obj, errors='replace')
if isinstance(obj, bytes) else obj
try: try:

View File

@@ -207,7 +207,7 @@ class DirectObjectAccess(object):
return None return None
try: try:
return cls.__name__ return u(cls.__name__)
except AttributeError: except AttributeError:
return None return None
@@ -311,8 +311,10 @@ class DirectObjectAccess(object):
def get_access_path_tuples(self): def get_access_path_tuples(self):
return [ return [
(getattr(o, '__name__', None), create_access(self._evaluator, o)) (
for o in self._get_objects_path() u(getattr(o, '__name__', None), errors='replace'),
create_access(self._evaluator, o)
) for o in self._get_objects_path()
] ]
def _get_objects_path(self): def _get_objects_path(self):

View File

@@ -284,7 +284,7 @@ class AccessHandle(object):
if name in ('id', 'access') or name.startswith('_'): if name in ('id', 'access') or name.startswith('_'):
raise AttributeError("Something went wrong with unpickling") raise AttributeError("Something went wrong with unpickling")
#print >> sys.stderr, name #if not is_py3: print >> sys.stderr, name
#print('getattr', name, file=sys.stderr) #print('getattr', name, file=sys.stderr)
return partial(self._workaround, name) return partial(self._workaround, name)

View File

@@ -17,8 +17,6 @@ def load_module(evaluator, **kwargs):
def get_compiled_method_return(evaluator, id, attribute, *args, **kwargs): def get_compiled_method_return(evaluator, id, attribute, *args, **kwargs):
handle = evaluator.compiled_subprocess.get_access_handle(id) handle = evaluator.compiled_subprocess.get_access_handle(id)
# print >> sys.stderr, handle, attribute, args, kwargs
# print(id, attribute, args, kwargs, file=sys.stderr)
return getattr(handle.access, attribute)(*args, **kwargs) return getattr(handle.access, attribute)(*args, **kwargs)