D2882: hgweb: convert an assert to a ProgrammingError
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Mar 16 19:15:55 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Because assert may get optimized away.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2882
AFFECTED FILES
mercurial/hgweb/webcommands.py
CHANGE DETAILS
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -1195,7 +1195,9 @@
web.res.headers['Content-Encoding'] = encoding
web.res.setbodywillwrite()
- assert list(web.res.sendresponse()) == []
+ if list(web.res.sendresponse()):
+ raise error.ProgrammingError('sendresponse() should not emit data '
+ 'if writing later')
bodyfh = web.res.getbodyfile()
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list