Fix #3758: Sphinx crashed if logs are emitted in conf.py

This commit is contained in:
Takeshi KOMIYA 2017-05-18 10:52:01 +09:00
parent 957f78fd6a
commit ec50d014ee
2 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,7 @@ Bugs fixed
* #3754: HTML builder crashes if HTML theme appends own stylesheets * #3754: HTML builder crashes if HTML theme appends own stylesheets
* #3756: epub: Entity 'mdash' not defined * #3756: epub: Entity 'mdash' not defined
* #3758: Sphinx crashed if logs are emitted in conf.py
Testing Testing
-------- --------

View File

@ -306,7 +306,13 @@ class WarningSuppressor(logging.Filter):
type = getattr(record, 'type', None) type = getattr(record, 'type', None)
subtype = getattr(record, 'subtype', None) subtype = getattr(record, 'subtype', None)
if is_suppressed_warning(type, subtype, self.app.config.suppress_warnings): try:
suppress_warnings = self.app.config.suppress_warnings
except AttributeError:
# config is not initialized yet (ex. in conf.py)
suppress_warnings = []
if is_suppressed_warning(type, subtype, suppress_warnings):
return False return False
else: else:
self.app._warncount += 1 self.app._warncount += 1