diff options
author | Georg Brandl <georg@python.org> | 2010-02-18 00:28:03 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-02-18 00:28:03 +0100 |
commit | 1d11ec72ea2dcb59204c7190544bf9071b4d03be (patch) | |
tree | e2ff9c76aa58811d289a9005fdcbff39b9e508a7 /pygments/util.py | |
parent | 8c8a5ba6269e3f9c9cf535d87611d8b71d6e6658 (diff) | |
download | pygments-1d11ec72ea2dcb59204c7190544bf9071b4d03be.tar.gz |
Fix opening unicode file under Py3k.
Diffstat (limited to 'pygments/util.py')
-rw-r--r-- | pygments/util.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pygments/util.py b/pygments/util.py index fc65b676..1bd1455f 100644 --- a/pygments/util.py +++ b/pygments/util.py @@ -8,8 +8,10 @@ :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ + import re import sys +import codecs split_path_re = re.compile(r'[/\\ ]') @@ -206,6 +208,7 @@ if sys.version_info < (3,0): import StringIO, cStringIO BytesIO = cStringIO.StringIO StringIO = StringIO.StringIO + uni_open = codecs.open else: import builtins bytes = builtins.bytes @@ -220,3 +223,4 @@ else: import io BytesIO = io.BytesIO StringIO = io.StringIO + uni_open = builtins.open |