1
0
forked from VimPlug/jedi

unicode strings should not raise an error if used in repr.

Python 2 doesn't allow unicode objects in __repr__ methods. Therefore we need to encode them as utf-8 bytes.
This commit is contained in:
Dave Halter
2015-03-25 23:39:53 +01:00
parent 4bb41b6096
commit 72fd190149
4 changed files with 30 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
from jedi._compatibility import encoding, is_py3
from jedi._compatibility import encoding, is_py3, u
import inspect
import os
import time
@@ -63,13 +63,13 @@ def dbg(message, *args):
mod = inspect.getmodule(frm[0])
if not (mod.__name__ in ignored_modules):
i = ' ' * _debug_indent
debug_function(NOTICE, i + 'dbg: ' + message % args)
debug_function(NOTICE, i + 'dbg: ' + message % tuple(u(repr(a)) for a in args))
def warning(message, *args):
if debug_function and enable_warning:
i = ' ' * _debug_indent
debug_function(WARNING, i + 'warning: ' + message % args)
debug_function(WARNING, i + 'warning: ' + message % tuple(u(repr(a)) for a in args))
def speed(name):