Patchwork D2882: hgweb: convert an assert to a ProgrammingError

login
register
mail settings
Submitter phabricator
Date March 17, 2018, 7:08 p.m.
Message ID <d3311cd913e41ae23b09878ae543ee5e@localhost.localdomain>
Download mbox | patch
Permalink /patch/29587/
State Not Applicable
Headers show

Comments

phabricator - March 17, 2018, 7:08 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa82fc3922446: hgweb: convert an assert to a ProgrammingError (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2882?vs=7079&id=7095

REVISION DETAIL
  https://phab.mercurial-scm.org/D2882

AFFECTED FILES
  mercurial/hgweb/webcommands.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

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()