Applied patch #1506758: Prevent MemoryErrors with large MAXFD.
diff --git a/Lib/popen2.py b/Lib/popen2.py
index b966d4c..6f56a92 100644
--- a/Lib/popen2.py
+++ b/Lib/popen2.py
@@ -79,7 +79,7 @@
     def _run_child(self, cmd):
         if isinstance(cmd, basestring):
             cmd = ['/bin/sh', '-c', cmd]
-        for i in range(3, MAXFD):
+        for i in xrange(3, MAXFD):
             try:
                 os.close(i)
             except OSError:
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index a281cd8..9c9cd69 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -941,7 +941,7 @@
 
 
         def _close_fds(self, but):
-            for i in range(3, MAXFD):
+            for i in xrange(3, MAXFD):
                 if i == but:
                     continue
                 try: