In the fdopen(fd, 'a') case on UNIX, don't try to set fd's flags to -1 if fcntl() and fdopen() both fail. Will backport.
In the fdopen(fd, 'a') case on UNIX, don't try to set fd's flags to -1 if
fcntl() and fdopen() both fail. Will backport.

sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator