diff mercurial/hgweb/webcommands.py @ 36977:a82fc3922446

hgweb: convert an assert to a ProgrammingError Because assert may get optimized away. Differential Revision: https://phab.mercurial-scm.org/D2882
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 16 Mar 2018 12:10:15 -0700
parents 4daa22071d5d
children c97b936d8bb5
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Fri Jan 19 18:52:50 2018 -0800
+++ b/mercurial/hgweb/webcommands.py	Fri Mar 16 12:10:15 2018 -0700
@@ -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()