avoid hasattr bc of py2, per @durin42's comments

This commit is contained in:
Mahmoud Hashemi 2017-07-29 19:09:53 -07:00
parent ba6941ec19
commit d4f5d8a3f3
1 changed files with 2 additions and 2 deletions

View File

@ -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'')):