mirror of
https://github.com/wassname/pyreadline.git
synced 2026-07-03 17:10:46 +08:00
pyreadline: Fix crash when readline called from doctest. stdout was replaced by dummy object, we now assume encoding=="ascii" if stdout.encdoding is missing.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2007-04-16 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu>
|
||||
* doctest imports pdb which imports readline, this means readline
|
||||
can be imported when a dummy object has replaced stdout. The dummy
|
||||
might miss the encoding property. We now assume stdout.encoding=="ascii"
|
||||
in this case.
|
||||
|
||||
2007-04-14 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu>
|
||||
* Changing binding for control-delete to forward_delete_word, adding tests to verify binding
|
||||
|
||||
|
||||
@@ -115,7 +115,13 @@ class CONSOLE_CURSOR_INFO(Structure):
|
||||
_fields_ = [("dwSize", c_int),
|
||||
("bVisible", c_byte)]
|
||||
|
||||
consolecodepage=sys.stdout.encoding
|
||||
|
||||
try:
|
||||
consolecodepage=sys.stdout.encoding
|
||||
except AttributeError: #This error occurs when pdb imports readline and doctest has replaced
|
||||
#stdout with stdout collector
|
||||
consolecodepage="ascii" #assume ascii codepage
|
||||
|
||||
def ensure_text(text):
|
||||
"""helper to ensure that text passed to WriteConsoleA is ascii"""
|
||||
if isinstance(text, unicode):
|
||||
|
||||
Reference in New Issue
Block a user