diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2012-12-31 22:54:59 +0100 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2012-12-31 22:54:59 +0100 |
| commit | a25569e742b4884d2198c0ea6a6f804e657f6f6d (patch) | |
| tree | 841812458a62648f36d17368e131362c4d8a3239 /sqlparse/lexer.py | |
| parent | f85b696fc10076be3e9fcf34085ef864f2121026 (diff) | |
| download | sqlparse-a25569e742b4884d2198c0ea6a6f804e657f6f6d.tar.gz | |
Python 3 is now fully supported without any patches.
This change makes the extras/py3k stuff obsolete and installing for
Python 3 is as easy as "python3 setup.py install". setup.py uses
distribute's use_2to3 flag to automatically run 2to3 when Python 3 is
used.
\o/ Happy New Year, everyone!
Diffstat (limited to 'sqlparse/lexer.py')
| -rw-r--r-- | sqlparse/lexer.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index 3348be8..a92e2b7 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -13,6 +13,7 @@ # and to allow some customizations. import re +import sys from sqlparse import tokens from sqlparse.keywords import KEYWORDS, KEYWORDS_COMMON @@ -220,6 +221,8 @@ class Lexer(object): self.filters.append(filter_) def _decode(self, text): + if sys.version_info[0] == 3: + return text if self.encoding == 'guess': try: text = text.decode('utf-8') @@ -249,7 +252,7 @@ class Lexer(object): elif self.stripnl: text = text.strip('\n') - if isinstance(text, unicode): + if sys.version_info[0] < 3 and isinstance(text, unicode): text = StringIO(text.encode('utf-8')) self.encoding = 'utf-8' else: |
