Skip to content

Commit

Permalink
tempfile: Refactor conditional function definition
Browse files Browse the repository at this point in the history
  • Loading branch information
JukkaL committed Jul 11, 2013
1 parent 8e25b89 commit 9510e92
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib-python/3.2/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@
try:
import fcntl as _fcntl
except ImportError:
def __set_cloexec(fd: int) -> None:
def _set_cloexec(fd: int) -> None:
pass
_set_cloexec = __set_cloexec
else:
def ___set_cloexec(fd: int) -> None:
def _set_cloexec(fd: int) -> None:
try:
flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
except IOError:
Expand All @@ -58,7 +57,6 @@ def ___set_cloexec(fd: int) -> None:
# flags read successfully, modify
flags |= _fcntl.FD_CLOEXEC
_fcntl.fcntl(fd, _fcntl.F_SETFD, flags)
_set_cloexec = ___set_cloexec


try:
Expand Down

0 comments on commit 9510e92

Please sign in to comment.