mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #4070: crashes when the warning message contains format strings
This commit is contained in:
parent
6b7e33a332
commit
a455ffcce1
1
CHANGES
1
CHANGES
@ -34,6 +34,7 @@ Bugs fixed
|
||||
* #4049: Fix typo in output of sphinx-build -h
|
||||
* #4062: hashlib.sha1() must take bytes, not unicode on Python 3
|
||||
* Avoid indent after index entries in latex (refs: #4066)
|
||||
* #4070: crashes when the warning message contains format strings
|
||||
|
||||
|
||||
Testing
|
||||
|
@ -356,10 +356,11 @@ class WarningIsErrorFilter(logging.Filter):
|
||||
return True
|
||||
elif self.app.warningiserror:
|
||||
location = getattr(record, 'location', '')
|
||||
message = record.msg.replace('%', '%%')
|
||||
if location:
|
||||
raise SphinxWarning(location + ":" + record.msg % record.args)
|
||||
raise SphinxWarning(location + ":" + message % record.args)
|
||||
else:
|
||||
raise SphinxWarning(record.msg % record.args)
|
||||
raise SphinxWarning(message % record.args)
|
||||
else:
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user