[PATCH] hgweb: don't try to wrap mod_wsgi loggers
Yuya Nishihara
yuya at tcha.org
Wed Sep 30 11:23:32 UTC 2020
On Tue, 29 Sep 2020 14:32:21 -0700, Ludovic Chabant wrote:
> # HG changeset patch
> # User Ludovic Chabant <ludovic at chabant.com>
> # Date 1601413962 25200
> # Tue Sep 29 14:12:42 2020 -0700
> # Node ID f8726d166fcaa0d690f6783146172758b2e14deb
> # Parent 80bf7b1ada15622ea45b8ecc5647404f5acb2905
> hgweb: don't try to wrap mod_wsgi loggers
>
> diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
> --- a/mercurial/utils/procutil.py
> +++ b/mercurial/utils/procutil.py
> @@ -108,6 +108,10 @@
> # The io.BufferedIOBase.write() contract guarantees that all data is
> # written.
> return stream
> + if str(type(stream).__module__) == 'mod_wsgi':
> + # WSGI loggers write all data. We couldn't even wrap them anyway since
> + # they typically don't return the number of bytes written.
> + return stream
Manuel, any comments?
It might be better to test isinstance(stream, io.RawIOBase). If the stream
is a RawIOBase, write() should return the number of bytes written.
More information about the Mercurial-devel
mailing list