summaryrefslogtreecommitdiff
path: root/sphinx/util/logging.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-09-24 13:52:59 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-09-24 13:52:59 +0900
commita455ffcce18d346cc4f77a9d51ebfe432eb40e38 (patch)
treec1e5ca76d898e0ea73bd2bbd0634c6881e764389 /sphinx/util/logging.py
parent6b7e33a33245f8a7acf3f3b0936bfcde2674bbaf (diff)
downloadsphinx-git-a455ffcce18d346cc4f77a9d51ebfe432eb40e38.tar.gz
Fix #4070: crashes when the warning message contains format strings
Diffstat (limited to 'sphinx/util/logging.py')
-rw-r--r--sphinx/util/logging.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py
index 04cb5fcab..2cdac6c40 100644
--- a/sphinx/util/logging.py
+++ b/sphinx/util/logging.py
@@ -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