ThirdParty/Pygments/pygments/formatters/terminal256.py

changeset 1705
b0fbc9300f2b
parent 684
2f29a0b6e1c7
child 2426
da76c71624de
--- a/ThirdParty/Pygments/pygments/formatters/terminal256.py	Mon Mar 12 19:01:48 2012 +0100
+++ b/ThirdParty/Pygments/pygments/formatters/terminal256.py	Mon Mar 12 19:03:42 2012 +0100
@@ -11,7 +11,7 @@
 
     Formatter version 1.
 
-    :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
@@ -24,6 +24,8 @@
 #    black-on-while, so colors like "white background" need to be converted
 #    to "white background, black foreground", etc...
 
+import sys
+
 from pygments.formatter import Formatter
 
 
@@ -185,7 +187,8 @@
         # hack: if the output is a terminal and has an encoding set,
         # use that to avoid unicode encode problems
         if not self.encoding and hasattr(outfile, "encoding") and \
-           hasattr(outfile, "isatty") and outfile.isatty():
+           hasattr(outfile, "isatty") and outfile.isatty() and \
+           sys.version_info < (3,):
             self.encoding = outfile.encoding
         return Formatter.format(self, tokensource, outfile)
 

eric ide

mercurial