diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 7543c7dfd22..beef313fab7 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -29,6 +29,7 @@ Andrew Leech Andrew Lytvyn Andrew Svetlov Andrii Soldatenko +Antoine Pietri Anton Kasyanov Arthur Darcet Ben Bader diff --git a/aiohttp/web.py b/aiohttp/web.py index 6caee4ce10d..ddf802e4675 100644 --- a/aiohttp/web.py +++ b/aiohttp/web.py @@ -422,6 +422,9 @@ def run_app(app, *, host=None, port=None, path=None, sock=None, app._set_loop(loop) loop.run_until_complete(app.startup()) + if print is None: + print = lambda *_: None + try: make_handler_kwargs = dict() if access_log_format is not None: diff --git a/changes/2260.feature b/changes/2260.feature new file mode 100644 index 00000000000..f78f339226a --- /dev/null +++ b/changes/2260.feature @@ -0,0 +1 @@ +run_app: Make print=None disable printing diff --git a/docs/web_reference.rst b/docs/web_reference.rst index a98929b7199..e7cb203c711 100644 --- a/docs/web_reference.rst +++ b/docs/web_reference.rst @@ -2400,7 +2400,8 @@ Utilities ``None`` for HTTP connection. :param print: a callable compatible with :func:`print`. May be used - to override STDOUT output or suppress it. + to override STDOUT output or suppress it. Passing `None` + disables output. :param int backlog: the number of unaccepted connections that the system will allow before refusing new