forked from VimPlug/jedi
switched completely to unicode (in python2), fixes #52
This commit is contained in:
@@ -58,8 +58,7 @@ else:
|
||||
try:
|
||||
unicode = unicode
|
||||
except NameError:
|
||||
def unicode(s):
|
||||
return s.decode("utf-8")
|
||||
unicode = str
|
||||
|
||||
# exec function
|
||||
if is_py3k:
|
||||
@@ -78,9 +77,9 @@ else:
|
||||
|
||||
# BytesIO (Python 2.5 has no io module)
|
||||
try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
from StringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
from io import BytesIO as BytesIO
|
||||
|
||||
# hasattr function used because python
|
||||
if is_py3k:
|
||||
|
||||
+2
-1
@@ -14,7 +14,7 @@ import keywords
|
||||
import helpers
|
||||
import builtin
|
||||
|
||||
from _compatibility import next
|
||||
from _compatibility import next, unicode
|
||||
|
||||
|
||||
class NotFoundError(Exception):
|
||||
@@ -201,6 +201,7 @@ class Script(object):
|
||||
:type source_path: string or None
|
||||
"""
|
||||
def __init__(self, source, line, column, source_path):
|
||||
source = unicode(source)
|
||||
self.pos = line, column
|
||||
self.module = modules.ModuleWithCursor(source_path, source=source,
|
||||
position=self.pos)
|
||||
|
||||
+3
-2
@@ -14,7 +14,8 @@ TODO nonlocal statement, needed or can be ignored? (py3k)
|
||||
|
||||
TODO __ instance attributes should not be visible outside of the class.
|
||||
"""
|
||||
from _compatibility import next, property, hasattr, is_py3k, use_metaclass
|
||||
from _compatibility import next, property, hasattr, is_py3k, use_metaclass, \
|
||||
unicode
|
||||
|
||||
import sys
|
||||
import itertools
|
||||
@@ -1407,7 +1408,7 @@ def follow_call_list(call_list):
|
||||
dynamic.ArrayInstance)):
|
||||
result.append(call)
|
||||
# The string tokens are just operations (+, -, etc.)
|
||||
elif not isinstance(call, str):
|
||||
elif not isinstance(call, (str, unicode)):
|
||||
if str(call.name) == 'if':
|
||||
# Ternary operators.
|
||||
while True:
|
||||
|
||||
@@ -59,6 +59,9 @@ def imitate_pydoc(string):
|
||||
It's not possible to get the pydoc's without starting the annoying pager
|
||||
stuff.
|
||||
"""
|
||||
# str needed because of possible unicode stuff in py2k (pydoc doesn't work
|
||||
# with unicode strings)
|
||||
string = str(string)
|
||||
h = pydoc.help
|
||||
try:
|
||||
# try to access symbols
|
||||
|
||||
Reference in New Issue
Block a user