Skip to content
Myr

feat: Move fcntl into outer scope for side effects

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 7eb990f · Browse files · 2 files+3 added−2 removed
This commit

State

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

Diff stats

2 files+3 added−2 removed

  • tests:+1 added−1 removed
  • other:+2 added−1 removed

2 files+3 added−2 removed

modified:click/_compat.py+2 added-1 removed
198 unmodified lines
199 except ImportError:200 pass201202 try:203 import fcntl204205 def set_binary_mode(f):206 try:207 fileno = f.fileno()208 except Exception:209 pass210 else:209 import fcntl211 flags = fcntl.fcntl(fileno, fcntl.F_GETFL)212 fcntl.fcntl(fileno, fcntl.F_SETFL, flags & ~os.O_NONBLOCK)213 return f214 except ImportError:
480 unmodified lines
modified:tests/test_imports.py+1 added-1 removed
30 unmodified lines
3132ALLOWED_IMPORTS = set([33 'weakref', 'os', 'struct', 'collections', 'sys', 'contextlib',34 'functools', 'stat', 're', 'codecs', 'inspect', 'itertools', 'io',35 'threading', 'colorama', 'errno'35 'threading', 'colorama', 'errno', 'fcntl'36])3738if WIN:39 ALLOWED_IMPORTS.update(['ctypes', 'ctypes.wintypes', 'msvcrt', 'time',
16 unmodified lines