Bug 874210 - Fix pymake stack depth issues when many targets and prerequisites are present. r=gps
authorZiga Seilnacht <ziga.seilnacht@gmail.com>
Fri, 08 Nov 2013 09:01:38 -0500
changeset 359 f99dd2f10896579885fb7fcef67d56d148f6a0a9
parent 358 87a4f61ed5fe7f7d14559052a58c2ac4f1b75d67
child 360 42627616700c5dc32375cbb4db2d9644b8661325
push id228
push userryanvm@gmail.com
push dateFri, 08 Nov 2013 14:02:32 +0000
reviewersgps
bugs874210
Bug 874210 - Fix pymake stack depth issues when many targets and prerequisites are present. r=gps
make.py
pymake/data.py
--- a/make.py
+++ b/make.py
@@ -12,20 +12,11 @@ import pymake.command, pymake.process
 import gc
 
 if __name__ == '__main__':
   sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
   sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
 
   gc.disable()
 
-  # This is meant as a temporary workaround until issues with many targets
-  # and prerequisites is addressed. Bug 874210 tracks.
-  #
-  # The default recursion limit for CPython is 1000.
-  try:
-      sys.setrecursionlimit(10000)
-  except Exception:
-      print >>sys.stderr, 'Unable to increase Python recursion limit.'
-
   pymake.command.main(sys.argv[1:], os.environ, os.getcwd(), cb=sys.exit)
   pymake.process.ParallelContext.spin()
   assert False, "Not reached"
--- a/pymake/data.py
+++ b/pymake/data.py
@@ -776,17 +776,18 @@ class RemakeTargetParallel(object):
             if not self.rulesremaining:
                 self.target.notifydone(self.makefile)
             return
 
         if self.rlist[0].depsremaining != 0:
             return
 
         self.currunning = True
-        self.rlist.pop(0).runcommands(self.indent, self.commandscb)
+        rule = self.rlist.pop(0)
+        self.makefile.context.defer(rule.runcommands, self.indent, self.commandscb)
 
     def commandscb(self, error):
         assert error in (True, False)
         if error:
             self.target.error = True
             self.makefile.error = True
 
         assert self.currunning