diff options
author | Georg Brandl <georg@python.org> | 2014-12-31 15:04:48 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-12-31 15:04:48 +0100 |
commit | 11eb1953abc3f07ce7f1a74255845b91dcce9698 (patch) | |
tree | c86cee210a1db94c174482967ace4449be8d1b7e | |
parent | 7d234df887f4238e410fca9a7ee134a459f02948 (diff) | |
download | sphinx-11eb1953abc3f07ce7f1a74255845b91dcce9698.tar.gz |
Fix memory leak during parallel writing with multiplied warnings.
-rw-r--r-- | sphinx/builders/__init__.py | 4 | ||||
-rw-r--r-- | sphinx/util/parallel.py | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 5370dd70..bbb9b311 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -357,9 +357,11 @@ class Builder(object): def _write_parallel(self, docnames, warnings, nproc): def write_process(docs): + local_warnings = [] + self.env.set_warnfunc(lambda *args: local_warnings.append(args)) for docname, doctree in docs: self.write_doc(docname, doctree) - return warnings + return local_warnings def add_warnings(docs, wlist): warnings.extend(wlist) diff --git a/sphinx/util/parallel.py b/sphinx/util/parallel.py index 5f9e8eff..7e238ab1 100644 --- a/sphinx/util/parallel.py +++ b/sphinx/util/parallel.py @@ -101,7 +101,9 @@ class ParallelTasks(object): del self._threads[tid] if exc: raise SphinxParallelError(*result) - self._result_funcs.pop(tid)(arg, result) + result_func = self._result_funcs.pop(tid)(arg, result) + if result_func: + result_func(result) self._nprocessed += 1 def join(self): @@ -110,7 +112,9 @@ class ParallelTasks(object): del self._threads[tid] if exc: raise SphinxParallelError(*result) - self._result_funcs.pop(tid)(arg, result) + result_func = self._result_funcs.pop(tid)(arg, result) + if result_func: + result_func(result) self._nprocessed += 1 # there shouldn't be any threads left... |