diff options
author | Andi Albrecht <albrecht.andi@gmail.com> | 2016-07-22 21:51:18 +0200 |
---|---|---|
committer | Andi Albrecht <albrecht.andi@gmail.com> | 2016-07-22 21:51:18 +0200 |
commit | 55a7d3ef1eee834e4e14fbd695f94b4fb1c73d21 (patch) | |
tree | a039b20d34fc6fbcfb065527b5b86ce4e32b68db /sqlparse/lexer.py | |
parent | d9c83c2e2ba1a2de837fb5221c4996b3c278232e (diff) | |
download | sqlparse-55a7d3ef1eee834e4e14fbd695f94b4fb1c73d21.tar.gz |
Fix parsing of streams (fixes #273).
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) |