Skip to content

Commit 785715e

Browse files
fix stdin bytes
--HG-- branch : scroll-frontend
1 parent 337568f commit 785715e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bpython/scrollfrontend/repl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from bpython import translations
1717
translations.init()
1818
from bpython.translations import _
19+
from bpython._py3compat import py3
1920

2021
from fmtstr.fsarray import FSArray
2122
from fmtstr.fmtstr import fmtstr, FmtStr
@@ -42,7 +43,6 @@
4243
#TODO proper raw_input (currently input isn't visible while typing, includes \r, and comes in as unicode in Python 2
4344
#TODO use events instead of length-one queues for interthread communication
4445

45-
#TODO raw_input should be bytes in python2
4646
#TODO check py3 compatibility
4747

4848

@@ -65,8 +65,9 @@ def process_event(self, e):
6565
#TODO EOF on ctrl-d
6666
else: # add normal character
6767
logging.debug('adding normal char %r to current line', e)
68+
c = e if py3 else e.encode('utf8')
6869
self.current_line = (self.current_line[:self.cursor_offset_in_line] +
69-
e +
70+
c +
7071
self.current_line[self.cursor_offset_in_line:])
7172
self.cursor_offset_in_line += 1
7273

0 commit comments

Comments
 (0)