Skip to content
Myr

Merge pull request #91 from invl/master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix binary mode stdio on Windows

authored by Armin Ronacher · committed by Armin Ronacher · parents f194189, 0030136 · Browse files · 1 file+9 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−0 removed

  • other:+9 added−0 removed

1 file+9 added−0 removed

modified:click/_compat.py+9 added
102 unmodified lines
103 iteritems = lambda x: x.iteritems()104105 _identifier_re = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]*$')106107 def set_binary_mode(f):108 if sys.platform == 'win32':109 import os110 import msvcrt111 msvcrt.setmode(f.fileno(), os.O_BINARY)112113 def isidentifier(x):114 return _identifier_re.search(x) is not None115116 def get_binary_stdin():117 set_binary_mode(sys.stdin)118 return sys.stdin119120 def get_binary_stdout():121 set_binary_mode(sys.stdout)122 return sys.stdout123124 def get_binary_stderr():125 set_binary_mode(sys.stderr)126 return sys.stderr127128 def get_text_stdin(encoding=None, errors=None):129 return _make_text_stream(sys.stdin, encoding, errors)
223 unmodified lines