mirror of
https://github.com/kennethreitz-archive/bpython-gist.git
synced 2026-06-05 15:40:17 +00:00
Bohdan Vlasyuk patch applied to check beforehand if sys.__stdout__.encoding exists
It falls back to sys.getdefaultencoding() if the stdout object doesn't have an encoding attribute.
This commit is contained in:
@@ -16,6 +16,9 @@ Mark Florisson (eggy) gave me a patch that stops weird breakage when unicode
|
||||
objects get added into the output buffer - they now get encoded into the output
|
||||
encoding.
|
||||
|
||||
Bohdan Vlasyuk sent me a patch that fixes a problem with the above patch from
|
||||
Mark if sys.__stdout__.encoding didn't exist.
|
||||
|
||||
v0.7.1
|
||||
======
|
||||
Added support for a history file, defaults to ~/.pythonhist and 100 lines but
|
||||
|
||||
+2
-2
@@ -951,7 +951,7 @@ class Repl(object):
|
||||
t = s
|
||||
|
||||
if isinstance(t, unicode):
|
||||
t = t.encode(sys.__stdout__.encoding)
|
||||
t = t.encode(getattr(sys.__stdout__, 'encoding') or sys.getdefaultencoding())
|
||||
|
||||
if not self.stdout_hist:
|
||||
self.stdout_hist = t
|
||||
@@ -986,7 +986,7 @@ class Repl(object):
|
||||
srings. It won't update the screen if it's reevaluating the code (as it
|
||||
does with undo)."""
|
||||
if isinstance(s, unicode):
|
||||
s = s.encode(sys.__stdout__.encoding)
|
||||
s = s.encode(getattr(sys.__stdout__, 'encoding') or sys.getdefaultencoding())
|
||||
|
||||
a = curses.color_pair(0)
|
||||
if '\x01' in s:
|
||||
|
||||
Reference in New Issue
Block a user