https://bz.mercurial-scm.org/show_bug.cgi?id=6956
Bug ID: 6956 Summary: ui.warn dies with TypeError on mod-wsgi Product: Mercurial Version: 6.8.2 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: jcris...@debian.org CC: mercurial-de...@mercurial-scm.org Python Version: --- mercurial warnings in hgweb seem to turn into exceptions as they fail to write to stderr: ``` File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/ui.py", line 1911, in warn self._writemsg(self._fmsgerr, type=b'warning', *msg, **opts) File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/ui.py", line 1342, in _writemsg _writemsgwith(self._write, dest, *args, **opts) File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/ui.py", line 2347, in _writemsgwith write(dest, *args, **opts) File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/ui.py", line 1285, in _write self._writenobuf(dest, *args, **opts) File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/ui.py", line 1310, in _writenobuf dest.write(msg) File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/utils/procutil.py", line 138, in write c = write1(m[total_written:]) TypeError: write() argument 1 must be read-only bytes-like object, not memoryview ``` As far as I can tell, mod-wsgi replaces sys.stderr with its own log object (https://github.com/GrahamDumpleton/mod_wsgi/blob/4.6.5/src/server/wsgi_interp.c#L540). The write method then uses PyArg_ParseTuple(..., "s#:write", ...) (https://github.com/GrahamDumpleton/mod_wsgi/blob/4.6.5/src/server/wsgi_logger.c#L348) which doesn't like the memoryview that's passed by hg. Looking at newer versions of mod-wsgi and the current python docs (https://docs.python.org/3/c-api/arg.html#c-arg-borrowed-buffer) this looks like it would still be relevant there. [See https://bugzilla.mozilla.org/show_bug.cgi?id=1943083] -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel