1
0
forked from VimPlug/jedi

python 2.5 compatibility, works, but tests fail, because certain thing don't exist in 2.5 (like int.real)

This commit is contained in:
David Halter
2012-05-20 00:56:49 +02:00
parent 8d523db9d9
commit fd1246818a
4 changed files with 18 additions and 13 deletions

View File

@@ -57,10 +57,23 @@ except NameError:
def unicode(s):
return s.decode("utf-8")
# Borrowed from Ned Batchelder
# exec function
if sys.hexversion > 0x03000000:
def exec_function(source, global_map):
exec(source, global_map)
else:
eval(compile("""def exec_function(source, global_map):
exec source in global_map """, 'blub', 'exec'))
# tokenize function
import tokenize
if sys.hexversion > 0x03000000:
tokenize_func = tokenize.tokenize
else:
tokenize_func = tokenize.generate_tokens
# BytesIO (Python 2.5 has no io module)
try:
from cStringIO import StringIO as BytesIO
except ImportError:
from io import BytesIO