[Bug #897935] Fix fd leak in pty.spawn().  Reported by James Henstridge; 2.3 bugfix candidate.
diff --git a/Lib/pty.py b/Lib/pty.py
index a70a865..cafbc9c 100644
--- a/Lib/pty.py
+++ b/Lib/pty.py
@@ -175,3 +175,5 @@
     except (IOError, OSError):
         if restore:
             tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode)
+
+    os.close(master_fd)