diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index c3a2ff54..f1502222 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -242,8 +242,7 @@ def cast_path(obj): Since this just really complicates everything and Python 2.7 will be EOL soon anyway, just go with always strings. """ - return unicode(obj, encoding='utf-8', errors='replace') \ - if isinstance(obj, bytes) else obj + return u(obj, errors='replace') try: diff --git a/jedi/evaluate/compiled/access.py b/jedi/evaluate/compiled/access.py index 9d1cfefd..b49a87f6 100644 --- a/jedi/evaluate/compiled/access.py +++ b/jedi/evaluate/compiled/access.py @@ -207,7 +207,7 @@ class DirectObjectAccess(object): return None try: - return cls.__name__ + return u(cls.__name__) except AttributeError: return None @@ -311,8 +311,10 @@ class DirectObjectAccess(object): def get_access_path_tuples(self): 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): diff --git a/jedi/evaluate/compiled/subprocess/__init__.py b/jedi/evaluate/compiled/subprocess/__init__.py index c2877fcd..153357a6 100644 --- a/jedi/evaluate/compiled/subprocess/__init__.py +++ b/jedi/evaluate/compiled/subprocess/__init__.py @@ -284,7 +284,7 @@ class AccessHandle(object): if name in ('id', 'access') or name.startswith('_'): 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) return partial(self._workaround, name) diff --git a/jedi/evaluate/compiled/subprocess/functions.py b/jedi/evaluate/compiled/subprocess/functions.py index 20e97798..c0653e64 100644 --- a/jedi/evaluate/compiled/subprocess/functions.py +++ b/jedi/evaluate/compiled/subprocess/functions.py @@ -17,8 +17,6 @@ def load_module(evaluator, **kwargs): def get_compiled_method_return(evaluator, id, attribute, *args, **kwargs): 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)