# HG changeset patch # User Gregory Szorc # Date 1521227415 25200 # Node ID a82fc39224460f1bfb56f6c9d8e6b7fb0f11d8c8 # Parent a4a95bd7158de9e932ccf5e8d60095609fbe9994 hgweb: convert an assert to a ProgrammingError Because assert may get optimized away. Differential Revision: https://phab.mercurial-scm.org/D2882 diff -r a4a95bd7158d -r a82fc3922446 mercurial/hgweb/webcommands.py --- 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()