From 4ee4e225a6ace98e78a03cccf8ee96c2202a12e3 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sat, 23 Feb 2013 21:10:22 +0430 Subject: [PATCH] don't encode strings in python3, affects davidhalter/jedi-vim#94 and @dbrgn --- jedi/parsing_representation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index 99209952..44a78344 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -92,7 +92,9 @@ class Simple(Base): return scope def __repr__(self): - code = self.get_code().replace('\n', ' ').encode(encoding, 'replace') + code = self.get_code().replace('\n', ' ') + if not is_py3k: + code = code.encode(encoding, 'replace') return "<%s: %s@%s,%s>" % \ (type(self).__name__, code, self.start_pos[0], self.start_pos[1])