mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Really fix the problem of keeping all pgen2 parser nodes in memory.
This commit is contained in:
parent
eff2bdd515
commit
e9fc8d890c
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user