]> granicus.if.org Git - python/commitdiff
Applied patch #1506758: Prevent MemoryErrors with large MAXFD.
authorPeter Astrand <astrand@lysator.liu.se>
Thu, 22 Jun 2006 20:21:26 +0000 (20:21 +0000)
committerPeter Astrand <astrand@lysator.liu.se>
Thu, 22 Jun 2006 20:21:26 +0000 (20:21 +0000)
Lib/popen2.py
Lib/subprocess.py

index b966d4c80eb1f47bfee141eb2efe25a6a8140129..6f56a926e99385df31ba9c1f340ddc54d8fd19bb 100644 (file)
@@ -79,7 +79,7 @@ class Popen3:
     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:
index a281cd8f2227d1a73bb699a301325ce08523198c..9c9cd69df278cb65636d0ef3320fd65e756bc64a 100644 (file)
@@ -941,7 +941,7 @@ class Popen(object):
 
 
         def _close_fds(self, but):
-            for i in range(3, MAXFD):
+            for i in xrange(3, MAXFD):
                 if i == but:
                     continue
                 try: