D2882: hgweb: convert an assert to a ProgrammingError

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Mar 17 15:08:39 EDT 2018


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

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, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list