diff --git a/sanic/__version__.py b/sanic/__version__.py index 43f6a244ce..faa7ddb987 100644 --- a/sanic/__version__.py +++ b/sanic/__version__.py @@ -1 +1 @@ -__version__ = "20.12.5" +__version__ = "20.12.6" diff --git a/sanic/app.py b/sanic/app.py index 850e1fe36b..0732bbd1da 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -2,6 +2,7 @@ import logging.config import os import re +import sys from asyncio import CancelledError, Protocol, ensure_future, get_event_loop from collections import defaultdict, deque @@ -65,6 +66,18 @@ def __init__( if configure_logging: logging.config.dictConfig(log_config or LOGGING_CONFIG_DEFAULTS) + if sys.version_info >= (3, 10): + error_logger.error( + "Unsupported version of Python has been detected.\n\nPython " + f"version {sys.version} is not supported by this version of " + "Sanic. There is a security advisory that has been issued for " + "Sanic v20.12 while running Python 3.10+. You should either " + "use a supported version of Python (v3.6 - v3.9) or upgrade " + "Sanic to v21+.\n\nPlease see https://github.com/sanic-org/" + "sanic/security/advisories/GHSA-7p79-6x2v-5h88 for " + "more information.\n" + ) + self.name = name self.asgi = False self.router = router or Router(self) diff --git a/sanic/server.py b/sanic/server.py index 07b755ede9..75c2bf79ee 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -169,7 +169,11 @@ def __init__( self.request_class = self.app.request_class or Request self.is_request_stream = self.app.is_request_stream self._is_stream_handler = False - self._not_paused = asyncio.Event(loop=deprecated_loop) + self._not_paused = ( + asyncio.Event() + if sys.version_info >= (3, 10) + else asyncio.Event(loop=deprecated_loop) + ) self._total_request_size = 0 self._request_timeout_handler = None self._response_timeout_handler = None