1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Move the encoding down into the Python 3 block

This commit is contained in:
Donald Stufft 2014-09-11 19:13:42 -04:00
parent 492c17bf30
commit 209a7ff5f6

View file

@ -9,12 +9,10 @@ import imp
import sys import sys
import site import site
uses_pycache = hasattr(imp, 'cache_from_source') uses_pycache = hasattr(imp, 'cache_from_source')
console_encoding = sys.__stdout__.encoding
try: try:
from logging.config import dictConfig as logging_dictConfig from logging.config import dictConfig as logging_dictConfig
except ImportError: except ImportError:
@ -24,7 +22,7 @@ except ImportError:
if sys.version_info >= (3,): if sys.version_info >= (3,):
def console_to_str(s): def console_to_str(s):
try: try:
return s.decode(console_encoding) return s.decode(sys.__stdout__.encoding)
except UnicodeDecodeError: except UnicodeDecodeError:
return s.decode('utf_8') return s.decode('utf_8')