Fix exception raise at rpdb session

Some components raise unrelated exceptions during rpdb session due to
unaware attribute handling of file-like objects

Change-Id: I04dd5a7d0f6ec2920671dfa612439427dffefd52
Closes-bug: #1791104
This commit is contained in:
BubaVV 2018-08-30 10:19:39 +03:00
parent 5b7c99bbc5
commit 6e0b90be22

View File

@ -42,7 +42,7 @@ def safe_decode(text, incoming=None, errors='strict'):
return text return text
if not incoming: if not incoming:
incoming = (sys.stdin.encoding or incoming = (getattr(sys.stdin, 'encoding', None) or
sys.getdefaultencoding()) sys.getdefaultencoding())
try: try:
@ -85,7 +85,7 @@ def safe_encode(text, incoming=None,
raise TypeError("%s can't be encoded" % type(text)) raise TypeError("%s can't be encoded" % type(text))
if not incoming: if not incoming:
incoming = (sys.stdin.encoding or incoming = (getattr(sys.stdin, 'encoding', None) or
sys.getdefaultencoding()) sys.getdefaultencoding())
# Avoid case issues in comparisons # Avoid case issues in comparisons