Dulwich.io dulwich / master
Avoid setting default streams that don't support bytestrings. Fixes #687 Jelmer Vernooń≥ 2 days ago
1 changed file(s) with 8 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
153153 return None
154154
155155
156 default_bytes_out_stream = getattr(
157 sys.stdout, 'buffer', sys.stdout
158 ) or NoneStream()
159 default_bytes_err_stream = getattr(
160 sys.stderr, 'buffer', sys.stderr
161 ) or NoneStream()
156 if sys.version_info[0] == 2:
157 default_bytes_out_stream = sys.stdout or NoneStream()
158 default_bytes_err_stream = sys.stderr or NoneStream()
159 else:
160 default_bytes_out_stream = (
161 getattr(sys.stdout, 'buffer', None) or NoneStream())
162 default_bytes_err_stream = (
163 getattr(sys.stderr, 'buffer', None) or NoneStream())
162164
163165
164166 DEFAULT_ENCODING = 'utf-8'