diff options
author | Georg Brandl <georg@python.org> | 2009-09-03 18:00:11 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-09-03 18:00:11 +0200 |
commit | 81bfd84f5eadaf4ee9bae4491239ed4a5ce9cd47 (patch) | |
tree | fdcf452e1e58df86a3cfa6230284098916f22f15 | |
parent | c73519e7cbfe8c3fc112fdc04c610a40b148cddc (diff) | |
download | sphinx-81bfd84f5eadaf4ee9bae4491239ed4a5ce9cd47.tar.gz |
Really fix the problem of keeping all pgen2 parser nodes in memory.
-rw-r--r-- | sphinx/ext/autodoc.py | 5 | ||||
-rw-r--r-- | sphinx/pycode/__init__.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index ea9a8f17..988a82e0 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -620,8 +620,9 @@ class Documenter(object): # try to also get a source code analyzer for attribute docs try: self.analyzer = ModuleAnalyzer.for_module(self.real_modname) - # parse right now, to get PycodeErrors on parsing - self.analyzer.parse() + # parse right now, to get PycodeErrors on parsing (results will + # be cached anyway) + self.analyzer.find_attr_docs() except PycodeError, err: # no source file -- e.g. for builtin and C modules self.analyzer = None diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index 1187b6a4..fa8d0e94 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -234,6 +234,8 @@ class ModuleAnalyzer(object): attr_visitor = AttrDocVisitor(number2name, scope, self.encoding) attr_visitor.visit(self.parsetree) self.attr_docs = attr_visitor.collected + # now that we found everything we could in the tree, throw it away + # (it takes quite a bit of memory for large modules) self.parsetree = None return attr_visitor.collected |