diff options
-rw-r--r-- | Lib/socketserver.py | 3 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-10-26-00-11-21.bpo-35017.6Ez4Cv.rst | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Lib/socketserver.py b/Lib/socketserver.py index 9dfd21b..f037791 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -230,6 +230,9 @@ class BaseServer: while not self.__shutdown_request: ready = selector.select(poll_interval) + # bpo-35017: shutdown() called during select(), exit immediately. + if self.__shutdown_request: + break if ready: self._handle_request_noblock() diff --git a/Misc/NEWS.d/next/Library/2018-10-26-00-11-21.bpo-35017.6Ez4Cv.rst b/Misc/NEWS.d/next/Library/2018-10-26-00-11-21.bpo-35017.6Ez4Cv.rst new file mode 100644 index 0000000..5682717 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-10-26-00-11-21.bpo-35017.6Ez4Cv.rst @@ -0,0 +1,3 @@ +:meth:`socketserver.BaseServer.serve_forever` now exits immediately if it's +:meth:`~socketserver.BaseServer.shutdown` method is called while it is +polling for new events. |