diff options
Diffstat (limited to 'sqlparse/lexer.py')
-rw-r--r-- | sqlparse/lexer.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index 6324962..3cf2be4 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -12,6 +12,8 @@ # It's separated from the rest of pygments to increase performance # and to allow some customizations. +from io import TextIOBase + from sqlparse import tokens from sqlparse.keywords import SQL_REGEX from sqlparse.compat import StringIO, string_types, u @@ -39,7 +41,7 @@ class Lexer(object): """ if isinstance(text, string_types): text = u(text, encoding) - elif isinstance(text, StringIO): + elif isinstance(text, (StringIO, TextIOBase)): text = u(text.read(), encoding) iterable = enumerate(text) |