Skip to content

Commit 2c0958f

Browse files
committed
Fix Python 3 compat (fixes bpython#550)
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
1 parent 5eed6af commit 2c0958f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bpython/pager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import sys
3030
import shlex
3131

32+
from bpython._py3compat import py3
33+
3234

3335
def get_pager_command(default='less -rf'):
3436
command = shlex.split(os.environ.get('PAGER', default))
@@ -51,7 +53,7 @@ def page(data, use_internal=False):
5153
curses.endwin()
5254
try:
5355
popen = subprocess.Popen(command, stdin=subprocess.PIPE)
54-
if isinstance(data, unicode):
56+
if py3 or isinstance(data, unicode):
5557
data = data.encode(sys.__stdout__.encoding, 'replace')
5658
popen.stdin.write(data)
5759
popen.stdin.close()

0 commit comments

Comments
 (0)