Skip to content

Commit 7423709

Browse files
committed
pyrepl/unix_eventqueue.py: Fix Python 3 ord(char) issue
In Python 3, byte strings are composed of ints, so no need to call ord() on the elements. Solves a test failure: testing/test_unix_reader.py:11: in test_simple > q.push(c) pyrepl/unix_eventqueue.py:103: in push > self.buf.append(ord(char)) E TypeError: ord() expected string of length 1, but int found
1 parent ee767d8 commit 7423709

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pyrepl/unix_eventqueue.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def insert(self, event):
100100
self.events.append(event)
101101

102102
def push(self, char):
103-
self.buf.append(ord(char))
103+
ord_char = char if isinstance(char, int) else ord(char)
104+
self.buf.append(ord_char)
104105
if char in self.k:
105106
if self.k is self.ck:
106107
#sanity check, buffer is empty when a special key comes

0 commit comments

Comments
 (0)