Skip to content

Commit f5179b4

Browse files
committed
Use Python3Lexer if running with Python 3.
Thanks to Germán Osella Massa for the patch. CLoses: bpython#222
1 parent ecff461 commit f5179b4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bpython/repl.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@
4444
from urlparse import urlparse
4545
from xmlrpclib import ServerProxy, Error as XMLRPCError
4646

47-
from pygments.lexers import PythonLexer
47+
py3 = sys.version_info[0] == 3
48+
4849
from pygments.token import Token
50+
if py3:
51+
from pygments.lexers import Python3Lexer as PythonLexer
52+
else:
53+
from pygments.lexers import PythonLexer
4954

5055
from bpython import importcompletion, inspection
5156
from bpython.formatter import Parenthesis
@@ -62,8 +67,6 @@
6267
except (ImportError, AttributeError):
6368
has_abc = False
6469

65-
py3 = sys.version_info[0] == 3
66-
6770

6871
class Interpreter(code.InteractiveInterpreter):
6972

0 commit comments

Comments
 (0)