diff options
author | BubaVV <vmarkov@mirantis.com> | 2018-08-30 10:19:39 +0300 |
---|---|---|
committer | BubaVV <vmarkov@mirantis.com> | 2018-09-07 10:15:51 +0300 |
commit | 6e0b90be22ccd1d22f937cb16128875a2e28746f (patch) | |
tree | bd1a7e2835c8e6e8312e534459f41784d39a9429 | |
parent | 5b7c99bbc514f6a9a80d338bd10cd7116d81dd77 (diff) | |
download | oslo-utils-6e0b90be22ccd1d22f937cb16128875a2e28746f.tar.gz |
Fix exception raise at rpdb session3.37.1
Some components raise unrelated exceptions during rpdb session due to
unaware attribute handling of file-like objects
Change-Id: I04dd5a7d0f6ec2920671dfa612439427dffefd52
Closes-bug: #1791104
-rw-r--r-- | oslo_utils/encodeutils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/oslo_utils/encodeutils.py b/oslo_utils/encodeutils.py index 845f916..0e177b2 100644 --- a/oslo_utils/encodeutils.py +++ b/oslo_utils/encodeutils.py @@ -42,7 +42,7 @@ def safe_decode(text, incoming=None, errors='strict'): return text if not incoming: - incoming = (sys.stdin.encoding or + incoming = (getattr(sys.stdin, 'encoding', None) or sys.getdefaultencoding()) try: @@ -85,7 +85,7 @@ def safe_encode(text, incoming=None, raise TypeError("%s can't be encoded" % type(text)) if not incoming: - incoming = (sys.stdin.encoding or + incoming = (getattr(sys.stdin, 'encoding', None) or sys.getdefaultencoding()) # Avoid case issues in comparisons |