From d4f5d8a3f348f33a7d06db6e6423a86d059969cb Mon Sep 17 00:00:00 2001 From: Mahmoud Hashemi Date: Sat, 29 Jul 2017 19:09:53 -0700 Subject: [PATCH] avoid hasattr bc of py2, per @durin42's comments --- boltons/ioutils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boltons/ioutils.py b/boltons/ioutils.py index 5c22612..c17369d 100644 --- a/boltons/ioutils.py +++ b/boltons/ioutils.py @@ -407,10 +407,10 @@ class SpooledStringIO(SpooledIOBase): def is_text_fileobj(fileobj): - if hasattr(fileobj, 'encoding'): + if getattr(fileobj, 'encoding', False): # codecs.open and io.TextIOBase return True - if hasattr(fileobj, 'getvalue'): + if getattr(fileobj, 'getvalue', False): # StringIO.StringIO / cStringIO.StringIO / io.StringIO try: if isinstance(fileobj.getvalue(), type(u'')):