From 4323027b1edb1329d8254b9f2f0da32df48d5494 Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Sat, 9 Dec 2023 03:54:46 +0100 Subject: [PATCH 1/5] drop long-default - coding: utf-8 --- docs/source/conf.py | 1 - examples/alt_spec.py | 1 - examples/boot_fail.py | 1 - examples/deep/test.py | 1 - examples/echo.py | 1 - examples/frameworks/tornadoapp.py | 1 - examples/longpoll.py | 1 - examples/multiapp.py | 1 - examples/multidomainapp.py | 1 - examples/readline_app.py | 1 - examples/sendfile.py | 1 - examples/slowclient.py | 1 - examples/standalone_app.py | 1 - examples/test.py | 1 - examples/timeout.py | 1 - examples/websocket/gevent_websocket.py | 1 - examples/websocket/websocket.py | 1 - gunicorn/__init__.py | 1 - gunicorn/__main__.py | 1 - gunicorn/app/__init__.py | 1 - gunicorn/app/base.py | 1 - gunicorn/app/pasterapp.py | 1 - gunicorn/app/wsgiapp.py | 1 - gunicorn/arbiter.py | 1 - gunicorn/config.py | 1 - gunicorn/debug.py | 1 - gunicorn/errors.py | 1 - gunicorn/glogging.py | 1 - gunicorn/http/__init__.py | 1 - gunicorn/http/body.py | 1 - gunicorn/http/errors.py | 1 - gunicorn/http/message.py | 1 - gunicorn/http/parser.py | 1 - gunicorn/http/unreader.py | 1 - gunicorn/http/wsgi.py | 1 - gunicorn/instrument/statsd.py | 1 - gunicorn/pidfile.py | 1 - gunicorn/reloader.py | 1 - gunicorn/sock.py | 1 - gunicorn/systemd.py | 1 - gunicorn/util.py | 1 - gunicorn/workers/__init__.py | 1 - gunicorn/workers/base.py | 1 - gunicorn/workers/base_async.py | 1 - gunicorn/workers/geventlet.py | 1 - gunicorn/workers/ggevent.py | 1 - gunicorn/workers/gthread.py | 1 - gunicorn/workers/gtornado.py | 1 - gunicorn/workers/sync.py | 1 - gunicorn/workers/workertmp.py | 1 - tests/t.py | 1 - tests/test_arbiter.py | 1 - tests/test_config.py | 1 - tests/test_http.py | 2 -- tests/test_invalid_requests.py | 1 - tests/test_pidfile.py | 1 - tests/test_sock.py | 1 - tests/test_ssl.py | 2 -- tests/test_systemd.py | 1 - tests/test_util.py | 1 - tests/test_valid_requests.py | 1 - tests/workers/test_geventlet.py | 1 - tests/workers/test_ggevent.py | 1 - 63 files changed, 65 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 8c94eb136..f000c2dba 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Gunicorn documentation build configuration file # diff --git a/examples/alt_spec.py b/examples/alt_spec.py index d5c682f1d..9a7e7c8cf 100644 --- a/examples/alt_spec.py +++ b/examples/alt_spec.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # An example of how to pass information from the command line to # a WSGI app. Only applies to the native WSGI workers used by diff --git a/examples/boot_fail.py b/examples/boot_fail.py index 0a2455ed6..c4f80f984 100644 --- a/examples/boot_fail.py +++ b/examples/boot_fail.py @@ -1,4 +1,3 @@ - raise RuntimeError("Bad app!") def app(environ, start_response): diff --git a/examples/deep/test.py b/examples/deep/test.py index 09ea06f08..dd5f8f693 100644 --- a/examples/deep/test.py +++ b/examples/deep/test.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/echo.py b/examples/echo.py index e10332d87..b03a72f3c 100644 --- a/examples/echo.py +++ b/examples/echo.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/frameworks/tornadoapp.py b/examples/frameworks/tornadoapp.py index f92365087..564496a40 100644 --- a/examples/frameworks/tornadoapp.py +++ b/examples/frameworks/tornadoapp.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/longpoll.py b/examples/longpoll.py index 5b5d8c96b..b1282090c 100644 --- a/examples/longpoll.py +++ b/examples/longpoll.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/multiapp.py b/examples/multiapp.py index c88885864..fdae7ecdf 100644 --- a/examples/multiapp.py +++ b/examples/multiapp.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/multidomainapp.py b/examples/multidomainapp.py index 25727badd..9d441a95f 100644 --- a/examples/multidomainapp.py +++ b/examples/multidomainapp.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/readline_app.py b/examples/readline_app.py index 4a87851bb..e72b90eb4 100644 --- a/examples/readline_app.py +++ b/examples/readline_app.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/sendfile.py b/examples/sendfile.py index d8489d9b8..7060ecda5 100644 --- a/examples/sendfile.py +++ b/examples/sendfile.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/slowclient.py b/examples/slowclient.py index 72041f86b..1eb582d04 100644 --- a/examples/slowclient.py +++ b/examples/slowclient.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/standalone_app.py b/examples/standalone_app.py index 7731aaf53..d4ec7caf4 100644 --- a/examples/standalone_app.py +++ b/examples/standalone_app.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # # An example of a standalone application using the internal API of Gunicorn. # diff --git a/examples/test.py b/examples/test.py index 09ea06f08..dd5f8f693 100644 --- a/examples/test.py +++ b/examples/test.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/timeout.py b/examples/timeout.py index 2e661b2bb..b6ca2b50d 100644 --- a/examples/timeout.py +++ b/examples/timeout.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/examples/websocket/gevent_websocket.py b/examples/websocket/gevent_websocket.py index c5855d4e2..c1c541df6 100644 --- a/examples/websocket/gevent_websocket.py +++ b/examples/websocket/gevent_websocket.py @@ -1,4 +1,3 @@ - import collections import errno import re diff --git a/examples/websocket/websocket.py b/examples/websocket/websocket.py index 63f709aeb..11b5f715c 100644 --- a/examples/websocket/websocket.py +++ b/examples/websocket/websocket.py @@ -1,4 +1,3 @@ - import collections import errno import re diff --git a/gunicorn/__init__.py b/gunicorn/__init__.py index 70153f8e6..45f53bcce 100644 --- a/gunicorn/__init__.py +++ b/gunicorn/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/__main__.py b/gunicorn/__main__.py index fda831570..ceb44d086 100644 --- a/gunicorn/__main__.py +++ b/gunicorn/__main__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/app/__init__.py b/gunicorn/app/__init__.py index 87f06117b..530e35ca4 100644 --- a/gunicorn/app/__init__.py +++ b/gunicorn/app/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/app/base.py b/gunicorn/app/base.py index dbd05bc7f..adb9fdb54 100644 --- a/gunicorn/app/base.py +++ b/gunicorn/app/base.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/app/pasterapp.py b/gunicorn/app/pasterapp.py index 4c9fc7def..b1738f250 100644 --- a/gunicorn/app/pasterapp.py +++ b/gunicorn/app/pasterapp.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/app/wsgiapp.py b/gunicorn/app/wsgiapp.py index 4e0031234..1b0ba969d 100644 --- a/gunicorn/app/wsgiapp.py +++ b/gunicorn/app/wsgiapp.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 1cf436748..35c3b3772 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/config.py b/gunicorn/config.py index 144acaecc..22b4a7227 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/debug.py b/gunicorn/debug.py index a492df9e4..a0aaa2bf1 100644 --- a/gunicorn/debug.py +++ b/gunicorn/debug.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/errors.py b/gunicorn/errors.py index 727d336ad..112838080 100644 --- a/gunicorn/errors.py +++ b/gunicorn/errors.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index b552e26a8..cb1fdabf8 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/http/__init__.py b/gunicorn/http/__init__.py index 1da6f3ec1..11473bb0a 100644 --- a/gunicorn/http/__init__.py +++ b/gunicorn/http/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py index 78f03214a..e4ca73dad 100644 --- a/gunicorn/http/body.py +++ b/gunicorn/http/body.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/http/errors.py b/gunicorn/http/errors.py index 340f0473c..0f67383e8 100644 --- a/gunicorn/http/errors.py +++ b/gunicorn/http/errors.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/http/message.py b/gunicorn/http/message.py index 88ffa5a25..013bccb07 100644 --- a/gunicorn/http/message.py +++ b/gunicorn/http/message.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/http/parser.py b/gunicorn/http/parser.py index 5d689f06a..8e8d8b097 100644 --- a/gunicorn/http/parser.py +++ b/gunicorn/http/parser.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/http/unreader.py b/gunicorn/http/unreader.py index 273bfc311..987da4640 100644 --- a/gunicorn/http/unreader.py +++ b/gunicorn/http/unreader.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index 6f3d9b68f..f8f6354e1 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/instrument/statsd.py b/gunicorn/instrument/statsd.py index 2c54b2e72..953dc12cd 100644 --- a/gunicorn/instrument/statsd.py +++ b/gunicorn/instrument/statsd.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/pidfile.py b/gunicorn/pidfile.py index 585b02af7..5b3d993d7 100644 --- a/gunicorn/pidfile.py +++ b/gunicorn/pidfile.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/reloader.py b/gunicorn/reloader.py index 88b540bdb..671e03370 100644 --- a/gunicorn/reloader.py +++ b/gunicorn/reloader.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/sock.py b/gunicorn/sock.py index 7700146a8..231649e28 100644 --- a/gunicorn/sock.py +++ b/gunicorn/sock.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/systemd.py b/gunicorn/systemd.py index 5bc1a7449..9b1855060 100644 --- a/gunicorn/systemd.py +++ b/gunicorn/systemd.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/util.py b/gunicorn/util.py index 751deea71..a5ee04a34 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/__init__.py b/gunicorn/workers/__init__.py index ae753e1cd..3da5f85e8 100644 --- a/gunicorn/workers/__init__.py +++ b/gunicorn/workers/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/base.py b/gunicorn/workers/base.py index f97d923c7..abdf911d7 100644 --- a/gunicorn/workers/base.py +++ b/gunicorn/workers/base.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/base_async.py b/gunicorn/workers/base_async.py index 6a79d7ed0..4ac3d7232 100644 --- a/gunicorn/workers/base_async.py +++ b/gunicorn/workers/base_async.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/geventlet.py b/gunicorn/workers/geventlet.py index c42ed1186..087eb61ec 100644 --- a/gunicorn/workers/geventlet.py +++ b/gunicorn/workers/geventlet.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/ggevent.py b/gunicorn/workers/ggevent.py index 2125a32d0..15552e874 100644 --- a/gunicorn/workers/ggevent.py +++ b/gunicorn/workers/ggevent.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/gthread.py b/gunicorn/workers/gthread.py index c9c42345f..8dd35a4d6 100644 --- a/gunicorn/workers/gthread.py +++ b/gunicorn/workers/gthread.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/gtornado.py b/gunicorn/workers/gtornado.py index 285061196..025de81bb 100644 --- a/gunicorn/workers/gtornado.py +++ b/gunicorn/workers/gtornado.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/sync.py b/gunicorn/workers/sync.py index ddcd77270..40eef4e1e 100644 --- a/gunicorn/workers/sync.py +++ b/gunicorn/workers/sync.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/gunicorn/workers/workertmp.py b/gunicorn/workers/workertmp.py index a9ae39de0..3252dd059 100644 --- a/gunicorn/workers/workertmp.py +++ b/gunicorn/workers/workertmp.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/t.py b/tests/t.py index 9b76e7deb..601337217 100644 --- a/tests/t.py +++ b/tests/t.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # Copyright 2009 Paul J. Davis # # This file is part of gunicorn released under the MIT license. diff --git a/tests/test_arbiter.py b/tests/test_arbiter.py index e856282c8..8c1527e26 100644 --- a/tests/test_arbiter.py +++ b/tests/test_arbiter.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/test_config.py b/tests/test_config.py index c094f6a21..ac2bb55cb 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/test_http.py b/tests/test_http.py index 0eb694601..9bbbdd5bb 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -1,5 +1,3 @@ -# -*- encoding: utf-8 -*- - import io import t import pytest diff --git a/tests/test_invalid_requests.py b/tests/test_invalid_requests.py index a4748640f..63224d07d 100644 --- a/tests/test_invalid_requests.py +++ b/tests/test_invalid_requests.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/test_pidfile.py b/tests/test_pidfile.py index ecbc052ff..81bb9d206 100644 --- a/tests/test_pidfile.py +++ b/tests/test_pidfile.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/test_sock.py b/tests/test_sock.py index adc348c6f..c3251af8c 100644 --- a/tests/test_sock.py +++ b/tests/test_sock.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/test_ssl.py b/tests/test_ssl.py index a31c1fe0f..6faea635d 100644 --- a/tests/test_ssl.py +++ b/tests/test_ssl.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 - - # Copyright 2013 Dariusz Suchojad # # This file is part of gunicorn released under the MIT license. diff --git a/tests/test_systemd.py b/tests/test_systemd.py index ff8b959a0..d9ef8afc4 100644 --- a/tests/test_systemd.py +++ b/tests/test_systemd.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/test_util.py b/tests/test_util.py index b7ba6e010..35e544f9e 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/test_valid_requests.py b/tests/test_valid_requests.py index 8c6290cdd..2c71622c4 100644 --- a/tests/test_valid_requests.py +++ b/tests/test_valid_requests.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/workers/test_geventlet.py b/tests/workers/test_geventlet.py index 06c7b5305..446f7037b 100644 --- a/tests/workers/test_geventlet.py +++ b/tests/workers/test_geventlet.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. diff --git a/tests/workers/test_ggevent.py b/tests/workers/test_ggevent.py index 261ce40df..f9a7bbfad 100644 --- a/tests/workers/test_ggevent.py +++ b/tests/workers/test_ggevent.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. From 422b18aceae25f891920efb2630035056ff5a77f Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Sat, 9 Dec 2023 03:59:09 +0100 Subject: [PATCH 2/5] class Name(object): -> class Name: --- examples/frameworks/cherryapp.py | 2 +- .../django/testing/testing/apps/someapp/middleware.py | 2 +- examples/longpoll.py | 2 +- examples/multiapp.py | 2 +- examples/websocket/gevent_websocket.py | 4 ++-- examples/websocket/websocket.py | 4 ++-- gunicorn/app/base.py | 2 +- gunicorn/arbiter.py | 2 +- gunicorn/config.py | 4 ++-- gunicorn/debug.py | 2 +- gunicorn/glogging.py | 2 +- gunicorn/http/body.py | 8 ++++---- gunicorn/http/message.py | 2 +- gunicorn/http/parser.py | 2 +- gunicorn/http/unreader.py | 2 +- gunicorn/http/wsgi.py | 4 ++-- gunicorn/pidfile.py | 2 +- gunicorn/reloader.py | 2 +- gunicorn/sock.py | 2 +- gunicorn/workers/base.py | 2 +- gunicorn/workers/ggevent.py | 2 +- gunicorn/workers/gthread.py | 2 +- gunicorn/workers/workertmp.py | 2 +- tests/t.py | 4 ++-- tests/test_config.py | 4 ++-- tests/test_statsd.py | 2 +- tests/treq.py | 2 +- 27 files changed, 36 insertions(+), 36 deletions(-) diff --git a/examples/frameworks/cherryapp.py b/examples/frameworks/cherryapp.py index 5b97ce0bc..fa9ea676a 100644 --- a/examples/frameworks/cherryapp.py +++ b/examples/frameworks/cherryapp.py @@ -1,7 +1,7 @@ import cherrypy -class Root(object): +class Root: @cherrypy.expose def index(self): return 'Hello World!' diff --git a/examples/frameworks/django/testing/testing/apps/someapp/middleware.py b/examples/frameworks/django/testing/testing/apps/someapp/middleware.py index ddc667a90..74d10c34a 100644 --- a/examples/frameworks/django/testing/testing/apps/someapp/middleware.py +++ b/examples/frameworks/django/testing/testing/apps/someapp/middleware.py @@ -8,7 +8,7 @@ def child_process(queue): requests.get('http://requestb.in/15s95oz1') -class GunicornSubProcessTestMiddleware(object): +class GunicornSubProcessTestMiddleware: def __init__(self): super().__init__() self.queue = Queue() diff --git a/examples/longpoll.py b/examples/longpoll.py index b1282090c..4b453d496 100644 --- a/examples/longpoll.py +++ b/examples/longpoll.py @@ -6,7 +6,7 @@ import sys import time -class TestIter(object): +class TestIter: def __iter__(self): lines = [b'line 1\n', b'line 2\n'] diff --git a/examples/multiapp.py b/examples/multiapp.py index fdae7ecdf..04edf08f0 100644 --- a/examples/multiapp.py +++ b/examples/multiapp.py @@ -24,7 +24,7 @@ from test import app as app2 -class Application(object): +class Application: def __init__(self): self.map = Mapper() self.map.connect('app1', '/app1url', app=app1) diff --git a/examples/websocket/gevent_websocket.py b/examples/websocket/gevent_websocket.py index c1c541df6..ff5109e52 100644 --- a/examples/websocket/gevent_websocket.py +++ b/examples/websocket/gevent_websocket.py @@ -16,7 +16,7 @@ WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" -class WebSocketWSGI(object): +class WebSocketWSGI: def __init__(self, handler): self.handler = handler @@ -117,7 +117,7 @@ def __call__(self, environ, start_response): # doesn't barf on the fact that we didn't call start_response return ALREADY_HANDLED -class WebSocket(object): +class WebSocket: """A websocket object that handles the details of serialization/deserialization to the socket. diff --git a/examples/websocket/websocket.py b/examples/websocket/websocket.py index 11b5f715c..0e8dffeb5 100644 --- a/examples/websocket/websocket.py +++ b/examples/websocket/websocket.py @@ -17,7 +17,7 @@ WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11" -class WebSocketWSGI(object): +class WebSocketWSGI: def __init__(self, handler): self.handler = handler @@ -118,7 +118,7 @@ def __call__(self, environ, start_response): # doesn't barf on the fact that we didn't call start_response return ALREADY_HANDLED -class WebSocket(object): +class WebSocket: """A websocket object that handles the details of serialization/deserialization to the socket. diff --git a/gunicorn/app/base.py b/gunicorn/app/base.py index adb9fdb54..9bf7a4f0f 100644 --- a/gunicorn/app/base.py +++ b/gunicorn/app/base.py @@ -13,7 +13,7 @@ from gunicorn import debug -class BaseApplication(object): +class BaseApplication: """ An application interface for configuring and loading the various necessities for any given web framework. diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 35c3b3772..d0a0a582e 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -17,7 +17,7 @@ from gunicorn import __version__, SERVER_SOFTWARE -class Arbiter(object): +class Arbiter: """ Arbiter maintain the workers processes alive. It launches or kills them if needed. It also manages application reloading diff --git a/gunicorn/config.py b/gunicorn/config.py index 22b4a7227..732f3eef4 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -42,7 +42,7 @@ def auto_int(_, x): return int(x, 0) -class Config(object): +class Config: def __init__(self, usage=None, prog=None): self.settings = make_settings() @@ -252,7 +252,7 @@ def fmt_desc(cls, desc): setattr(cls, "short", desc.splitlines()[0]) -class Setting(object): +class Setting: name = None value = None section = None diff --git a/gunicorn/debug.py b/gunicorn/debug.py index a0aaa2bf1..7db826394 100644 --- a/gunicorn/debug.py +++ b/gunicorn/debug.py @@ -15,7 +15,7 @@ _token_spliter = re.compile(r'\W+') -class Spew(object): +class Spew: def __init__(self, trace_names=None, show_values=True): self.trace_names = trace_names diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index cb1fdabf8..e34fcd5f7 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -161,7 +161,7 @@ def parse_syslog_address(addr): return (socktype, (host, port)) -class Logger(object): +class Logger: LOG_LEVELS = { "critical": logging.CRITICAL, diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py index e4ca73dad..27f6605c4 100644 --- a/gunicorn/http/body.py +++ b/gunicorn/http/body.py @@ -9,7 +9,7 @@ InvalidChunkSize) -class ChunkedReader(object): +class ChunkedReader: def __init__(self, req, unreader): self.req = req self.parser = self.parse_chunked(unreader) @@ -107,7 +107,7 @@ def get_data(self, unreader, buf): buf.write(data) -class LengthReader(object): +class LengthReader: def __init__(self, unreader, length): self.unreader = unreader self.length = length @@ -137,7 +137,7 @@ def read(self, size): return ret -class EOFReader(object): +class EOFReader: def __init__(self, unreader): self.unreader = unreader self.buf = io.BytesIO() @@ -175,7 +175,7 @@ def read(self, size): return ret -class Body(object): +class Body: def __init__(self, reader): self.reader = reader self.buf = io.BytesIO() diff --git a/gunicorn/http/message.py b/gunicorn/http/message.py index 013bccb07..1e1d8d9e1 100644 --- a/gunicorn/http/message.py +++ b/gunicorn/http/message.py @@ -29,7 +29,7 @@ VERSION_RE = re.compile(r"HTTP/(\d)\.(\d)") -class Message(object): +class Message: def __init__(self, cfg, unreader, peer_addr): self.cfg = cfg self.unreader = unreader diff --git a/gunicorn/http/parser.py b/gunicorn/http/parser.py index 8e8d8b097..88da17ab0 100644 --- a/gunicorn/http/parser.py +++ b/gunicorn/http/parser.py @@ -6,7 +6,7 @@ from gunicorn.http.unreader import SocketUnreader, IterUnreader -class Parser(object): +class Parser: mesg_class = None diff --git a/gunicorn/http/unreader.py b/gunicorn/http/unreader.py index 987da4640..9aadfbcff 100644 --- a/gunicorn/http/unreader.py +++ b/gunicorn/http/unreader.py @@ -9,7 +9,7 @@ # a given type of data source. -class Unreader(object): +class Unreader: def __init__(self): self.buf = io.BytesIO() diff --git a/gunicorn/http/wsgi.py b/gunicorn/http/wsgi.py index f8f6354e1..419ac503a 100644 --- a/gunicorn/http/wsgi.py +++ b/gunicorn/http/wsgi.py @@ -24,7 +24,7 @@ log = logging.getLogger(__name__) -class FileWrapper(object): +class FileWrapper: def __init__(self, filelike, blksize=8192): self.filelike = filelike @@ -197,7 +197,7 @@ def create(req, sock, client, server, cfg): return resp, environ -class Response(object): +class Response: def __init__(self, req, sock, cfg): self.req = req diff --git a/gunicorn/pidfile.py b/gunicorn/pidfile.py index 5b3d993d7..06abb34e8 100644 --- a/gunicorn/pidfile.py +++ b/gunicorn/pidfile.py @@ -7,7 +7,7 @@ import tempfile -class Pidfile(object): +class Pidfile: """\ Manage a PID file. If a specific name is provided it and '"%s.oldpid" % name' will be used. Otherwise diff --git a/gunicorn/reloader.py b/gunicorn/reloader.py index 671e03370..1c67f2a7d 100644 --- a/gunicorn/reloader.py +++ b/gunicorn/reloader.py @@ -116,7 +116,7 @@ def run(self): else: - class InotifyReloader(object): + class InotifyReloader: def __init__(self, extra_files=None, callback=None): raise ImportError('You must have the inotify module installed to ' 'use the inotify reloader') diff --git a/gunicorn/sock.py b/gunicorn/sock.py index 231649e28..751e9c7ae 100644 --- a/gunicorn/sock.py +++ b/gunicorn/sock.py @@ -13,7 +13,7 @@ from gunicorn import util -class BaseSocket(object): +class BaseSocket: def __init__(self, address, conf, log, fd=None): self.log = log diff --git a/gunicorn/workers/base.py b/gunicorn/workers/base.py index abdf911d7..dc9546980 100644 --- a/gunicorn/workers/base.py +++ b/gunicorn/workers/base.py @@ -25,7 +25,7 @@ from gunicorn.workers.workertmp import WorkerTmp -class Worker(object): +class Worker: SIGNALS = [getattr(signal, "SIG%s" % x) for x in ( "ABRT HUP QUIT INT TERM USR1 USR2 WINCH CHLD".split() diff --git a/gunicorn/workers/ggevent.py b/gunicorn/workers/ggevent.py index 15552e874..42a6f21bb 100644 --- a/gunicorn/workers/ggevent.py +++ b/gunicorn/workers/ggevent.py @@ -146,7 +146,7 @@ def init_process(self): super().init_process() -class GeventResponse(object): +class GeventResponse: status = None headers = None diff --git a/gunicorn/workers/gthread.py b/gunicorn/workers/gthread.py index 8dd35a4d6..9edb98b2c 100644 --- a/gunicorn/workers/gthread.py +++ b/gunicorn/workers/gthread.py @@ -30,7 +30,7 @@ from ..http import wsgi -class TConn(object): +class TConn: def __init__(self, cfg, sock, client, server): self.cfg = cfg diff --git a/gunicorn/workers/workertmp.py b/gunicorn/workers/workertmp.py index 3252dd059..8ef00a560 100644 --- a/gunicorn/workers/workertmp.py +++ b/gunicorn/workers/workertmp.py @@ -13,7 +13,7 @@ IS_CYGWIN = PLATFORM.startswith('CYGWIN') -class WorkerTmp(object): +class WorkerTmp: def __init__(self, cfg): old_umask = os.umask(cfg.umask) diff --git a/tests/t.py b/tests/t.py index 601337217..4f1fcaf50 100644 --- a/tests/t.py +++ b/tests/t.py @@ -21,7 +21,7 @@ def data_source(fname): return buf -class request(object): +class request: def __init__(self, name): self.fname = os.path.join(dirname, "requests", name) @@ -33,7 +33,7 @@ def run(): return run -class FakeSocket(object): +class FakeSocket: def __init__(self, data): self.tmp = tempfile.TemporaryFile() diff --git a/tests/test_config.py b/tests/test_config.py index ac2bb55cb..7d07dd661 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -31,7 +31,7 @@ def paster_ini(): return os.path.join(dirname, "..", "examples", "frameworks", "pylonstest", "nose.ini") -class AltArgs(object): +class AltArgs: def __init__(self, args=None): self.args = args or [] self.orig = sys.argv @@ -97,7 +97,7 @@ def test_property_access(): # Not a config property pytest.raises(AttributeError, getattr, c, "foo") # Force to be not an error - class Baz(object): + class Baz: def get(self): return 3.14 c.settings["foo"] = Baz() diff --git a/tests/test_statsd.py b/tests/test_statsd.py index 6f7bf426b..88adb0040 100644 --- a/tests/test_statsd.py +++ b/tests/test_statsd.py @@ -15,7 +15,7 @@ class StatsdTestException(Exception): pass -class MockSocket(object): +class MockSocket: "Pretend to be a UDP socket" def __init__(self, failp): self.failp = failp diff --git a/tests/treq.py b/tests/treq.py index aeaae151f..fbe54700e 100644 --- a/tests/treq.py +++ b/tests/treq.py @@ -39,7 +39,7 @@ def load_py(fname): return vars(mod) -class request(object): +class request: def __init__(self, fname, expect): self.fname = fname self.name = os.path.basename(fname) From 78ef73b63ec8b242b407721b9e199d7131a041a7 Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Sat, 9 Dec 2023 04:03:50 +0100 Subject: [PATCH 3/5] Python3: super() args not typically needed --- gunicorn/workers/gtornado.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gunicorn/workers/gtornado.py b/gunicorn/workers/gtornado.py index 025de81bb..544af7d09 100644 --- a/gunicorn/workers/gtornado.py +++ b/gunicorn/workers/gtornado.py @@ -134,7 +134,7 @@ class _HTTPServer(tornado.httpserver.HTTPServer): def on_close(instance, server_conn): self.handle_request() - super(_HTTPServer, instance).on_close(server_conn) + super().on_close(server_conn) server_class = _HTTPServer From ec85b32d3b9a3f57ed06d932930d437abb87e62c Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Sat, 9 Dec 2023 04:06:40 +0100 Subject: [PATCH 4/5] Pythn 2.7+: open arg defaults to r --- gunicorn/pidfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/pidfile.py b/gunicorn/pidfile.py index 06abb34e8..c1dd1cb97 100644 --- a/gunicorn/pidfile.py +++ b/gunicorn/pidfile.py @@ -51,7 +51,7 @@ def rename(self, path): def unlink(self): """ delete pidfile""" try: - with open(self.fname, "r") as f: + with open(self.fname) as f: pid1 = int(f.read() or 0) if pid1 == self.pid: @@ -64,7 +64,7 @@ def validate(self): if not self.fname: return try: - with open(self.fname, "r") as f: + with open(self.fname) as f: try: wpid = int(f.read()) except ValueError: From 4f7766585d899cc3b6502355ad4c93d8ca18f093 Mon Sep 17 00:00:00 2001 From: "Paul J. Dorn" Date: Sat, 9 Dec 2023 04:08:51 +0100 Subject: [PATCH 5/5] Python 3.3+: replace deprecated aliases since 3.3: EnvironmentError, IOError, socket.error and select.error are merged into IOError. They may now return a more specific subclass - which this commit does not utilize yet. --- examples/when_ready.conf.py | 2 +- gunicorn/arbiter.py | 4 ++-- gunicorn/debug.py | 2 +- gunicorn/http/message.py | 4 ++-- gunicorn/pidfile.py | 2 +- gunicorn/sock.py | 6 +++--- gunicorn/util.py | 8 ++++---- gunicorn/workers/base_async.py | 8 ++++---- gunicorn/workers/gthread.py | 10 +++++----- gunicorn/workers/sync.py | 12 ++++++------ 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/examples/when_ready.conf.py b/examples/when_ready.conf.py index 1531ec14a..dc8480ef6 100644 --- a/examples/when_ready.conf.py +++ b/examples/when_ready.conf.py @@ -17,7 +17,7 @@ def __init__(self, server, max_mem): def memory_usage(self, pid): try: out = commands.getoutput("ps -o rss -p %s" % pid) - except IOError: + except OSError: return -1 used_mem = sum(int(x) for x in out.split('\n')[1:]) return used_mem diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index d0a0a582e..e84dd02f8 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -332,7 +332,7 @@ def wakeup(self): """ try: os.write(self.PIPE[1], b'.') - except IOError as e: + except OSError as e: if e.errno not in [errno.EAGAIN, errno.EINTR]: raise @@ -361,7 +361,7 @@ def sleep(self): return while os.read(self.PIPE[0], 1): pass - except (select.error, OSError) as e: + except OSError as e: # TODO: select.error is a subclass of OSError since Python 3.3. error_number = getattr(e, 'errno', e.args[0]) if error_number not in [errno.EAGAIN, errno.EINTR]: diff --git a/gunicorn/debug.py b/gunicorn/debug.py index 7db826394..5fae0b4dd 100644 --- a/gunicorn/debug.py +++ b/gunicorn/debug.py @@ -36,7 +36,7 @@ def __call__(self, frame, event, arg): try: src = inspect.getsourcelines(frame) line = src[lineno] - except IOError: + except OSError: line = 'Unknown code named [%s]. VM instruction #%d' % ( frame.f_code.co_name, frame.f_lasti) if self.trace_names is None or name in self.trace_names: diff --git a/gunicorn/http/message.py b/gunicorn/http/message.py index 1e1d8d9e1..a39d84929 100644 --- a/gunicorn/http/message.py +++ b/gunicorn/http/message.py @@ -372,13 +372,13 @@ def parse_proxy_protocol(self, line): try: socket.inet_pton(socket.AF_INET, s_addr) socket.inet_pton(socket.AF_INET, d_addr) - except socket.error: + except OSError: raise InvalidProxyLine(line) elif proto == "TCP6": try: socket.inet_pton(socket.AF_INET6, s_addr) socket.inet_pton(socket.AF_INET6, d_addr) - except socket.error: + except OSError: raise InvalidProxyLine(line) try: diff --git a/gunicorn/pidfile.py b/gunicorn/pidfile.py index c1dd1cb97..b171f7d91 100644 --- a/gunicorn/pidfile.py +++ b/gunicorn/pidfile.py @@ -79,7 +79,7 @@ def validate(self): if e.args[0] == errno.ESRCH: return raise - except IOError as e: + except OSError as e: if e.args[0] == errno.ENOENT: return raise diff --git a/gunicorn/sock.py b/gunicorn/sock.py index 751e9c7ae..c62298554 100644 --- a/gunicorn/sock.py +++ b/gunicorn/sock.py @@ -42,7 +42,7 @@ def set_options(self, sock, bound=False): and hasattr(socket, 'SO_REUSEPORT')): # pragma: no cover try: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) - except socket.error as err: + except OSError as err: if err.errno not in (errno.ENOPROTOOPT, errno.EINVAL): raise if not bound: @@ -65,7 +65,7 @@ def close(self): try: self.sock.close() - except socket.error as e: + except OSError as e: self.log.info("Error while closing socket %s", str(e)) self.sock = None @@ -182,7 +182,7 @@ def create_sockets(conf, log, fds=None): for i in range(5): try: sock = sock_type(addr, conf, log) - except socket.error as e: + except OSError as e: if e.args[0] == errno.EADDRINUSE: log.error("Connection in use: %s", str(addr)) if e.args[0] == errno.EADDRNOTAVAIL: diff --git a/gunicorn/util.py b/gunicorn/util.py index a5ee04a34..ecd817472 100644 --- a/gunicorn/util.py +++ b/gunicorn/util.py @@ -216,7 +216,7 @@ def unlink(filename): def is_ipv6(addr): try: socket.inet_pton(socket.AF_INET6, addr) - except socket.error: # not a valid address + except OSError: # not a valid address return False except ValueError: # ipv6 not supported on this platform return False @@ -268,7 +268,7 @@ def set_non_blocking(fd): def close(sock): try: sock.close() - except socket.error: + except OSError: pass @@ -565,7 +565,7 @@ def check_is_writable(path): try: with open(path, 'a') as f: f.close() - except IOError as e: + except OSError as e: raise RuntimeError("Error: '%s' isn't writable [%r]" % (path, e)) @@ -586,7 +586,7 @@ def has_fileno(obj): # check BytesIO case and maybe others try: obj.fileno() - except (AttributeError, IOError, io.UnsupportedOperation): + except (AttributeError, OSError, io.UnsupportedOperation): return False return True diff --git a/gunicorn/workers/base_async.py b/gunicorn/workers/base_async.py index 4ac3d7232..9466d6aaa 100644 --- a/gunicorn/workers/base_async.py +++ b/gunicorn/workers/base_async.py @@ -59,7 +59,7 @@ def handle(self, listener, client, addr): except ssl.SSLError: # pass to next try-except level util.reraise(*sys.exc_info()) - except EnvironmentError: + except OSError: # pass to next try-except level util.reraise(*sys.exc_info()) except Exception as e: @@ -71,7 +71,7 @@ def handle(self, listener, client, addr): else: self.log.debug("Error processing SSL request.") self.handle_error(req, client, addr, e) - except EnvironmentError as e: + except OSError as e: if e.errno not in (errno.EPIPE, errno.ECONNRESET, errno.ENOTCONN): self.log.exception("Socket error processing request.") else: @@ -123,7 +123,7 @@ def handle_request(self, listener_name, req, sock, addr): raise StopIteration() except StopIteration: raise - except EnvironmentError: + except OSError: # If the original exception was a socket.error we delegate # handling it to the caller (where handle() might ignore it) util.reraise(*sys.exc_info()) @@ -135,7 +135,7 @@ def handle_request(self, listener_name, req, sock, addr): try: sock.shutdown(socket.SHUT_RDWR) sock.close() - except EnvironmentError: + except OSError: pass raise StopIteration() raise diff --git a/gunicorn/workers/gthread.py b/gunicorn/workers/gthread.py index 9edb98b2c..7a23228cd 100644 --- a/gunicorn/workers/gthread.py +++ b/gunicorn/workers/gthread.py @@ -127,7 +127,7 @@ def accept(self, server, listener): with self._lock: self.poller.register(conn.sock, selectors.EVENT_READ, partial(self.on_client_socket_readable, conn)) - except EnvironmentError as e: + except OSError as e: if e.errno not in (errno.EAGAIN, errno.ECONNABORTED, errno.EWOULDBLOCK): raise @@ -170,7 +170,7 @@ def murder_keepalived(self): with self._lock: try: self.poller.unregister(conn.sock) - except EnvironmentError as e: + except OSError as e: if e.errno != errno.EBADF: raise except KeyError: @@ -294,7 +294,7 @@ def handle(self, conn): self.log.debug("Error processing SSL request.") self.handle_error(req, conn.sock, conn.client, e) - except EnvironmentError as e: + except OSError as e: if e.errno not in (errno.EPIPE, errno.ECONNRESET, errno.ENOTCONN): self.log.exception("Socket error processing request.") else: @@ -348,7 +348,7 @@ def handle_request(self, req, conn): if resp.should_close(): self.log.debug("Closing connection.") return False - except EnvironmentError: + except OSError: # pass to next try-except level util.reraise(*sys.exc_info()) except Exception: @@ -359,7 +359,7 @@ def handle_request(self, req, conn): try: conn.sock.shutdown(socket.SHUT_RDWR) conn.sock.close() - except EnvironmentError: + except OSError: pass raise StopIteration() raise diff --git a/gunicorn/workers/sync.py b/gunicorn/workers/sync.py index 40eef4e1e..4c029f912 100644 --- a/gunicorn/workers/sync.py +++ b/gunicorn/workers/sync.py @@ -39,7 +39,7 @@ def wait(self, timeout): os.read(self.PIPE[0], 1) return ret[0] - except select.error as e: + except OSError as e: if e.args[0] == errno.EINTR: return self.sockets if e.args[0] == errno.EBADF: @@ -72,7 +72,7 @@ def run_for_one(self, timeout): # process. continue - except EnvironmentError as e: + except OSError as e: if e.errno not in (errno.EAGAIN, errno.ECONNABORTED, errno.EWOULDBLOCK): raise @@ -101,7 +101,7 @@ def run_for_multiple(self, timeout): try: self.accept(listener) - except EnvironmentError as e: + except OSError as e: if e.errno not in (errno.EAGAIN, errno.ECONNABORTED, errno.EWOULDBLOCK): raise @@ -143,7 +143,7 @@ def handle(self, listener, client, addr): else: self.log.debug("Error processing SSL request.") self.handle_error(req, client, addr, e) - except EnvironmentError as e: + except OSError as e: if e.errno not in (errno.EPIPE, errno.ECONNRESET, errno.ENOTCONN): self.log.exception("Socket error processing request.") else: @@ -187,7 +187,7 @@ def handle_request(self, listener, req, client, addr): self.log.access(resp, req, environ, request_time) if hasattr(respiter, "close"): respiter.close() - except EnvironmentError: + except OSError: # pass to next try-except level util.reraise(*sys.exc_info()) except Exception: @@ -198,7 +198,7 @@ def handle_request(self, listener, req, client, addr): try: client.shutdown(socket.SHUT_RDWR) client.close() - except EnvironmentError: + except OSError: pass raise StopIteration() raise