diff options
author | Igor Kalnitsky <igor@kalnitsky.org> | 2012-02-07 21:29:58 +0200 |
---|---|---|
committer | Igor Kalnitsky <igor@kalnitsky.org> | 2012-02-07 21:29:58 +0200 |
commit | 3d1b3982a4b4fb5dc8ad5eba70b2416fb980b8ec (patch) | |
tree | f086edf649eceda1602c73e3559b786585287407 /pygments/formatters/terminal256.py | |
parent | 62213ae784abde261ec76d59d3bbfc2f0967dc28 (diff) | |
parent | b42b337d32c87768594934d01e0f40b4c83a435f (diff) | |
download | pygments-3d1b3982a4b4fb5dc8ad5eba70b2416fb980b8ec.tar.gz |
Merge with birkenfeld/pygments-main
Diffstat (limited to 'pygments/formatters/terminal256.py')
-rw-r--r-- | pygments/formatters/terminal256.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py index bf8ee0ff..cbd30be1 100644 --- a/pygments/formatters/terminal256.py +++ b/pygments/formatters/terminal256.py @@ -11,7 +11,7 @@ Formatter version 1. - :copyright: Copyright 2006-2011 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 @@ class Terminal256Formatter(Formatter): # 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) |