fix 1748 : Drop DeprecationWarning in python 3.8 (#1750)
https://github.com/huge-success/sanic/issues/1748
This commit is contained in:
parent
2f776eba85
commit
3430907046
|
@ -1,5 +1,6 @@
|
|||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from collections import deque
|
||||
|
@ -134,6 +135,9 @@ class HttpProtocol(asyncio.Protocol):
|
|||
self.request_class = request_class or Request
|
||||
self.is_request_stream = is_request_stream
|
||||
self._is_stream_handler = False
|
||||
if sys.version_info.minor >= 8:
|
||||
self._not_paused = asyncio.Event()
|
||||
else:
|
||||
self._not_paused = asyncio.Event(loop=loop)
|
||||
self._total_request_size = 0
|
||||
self._request_timeout_handler = None
|
||||
|
@ -951,7 +955,10 @@ def serve(
|
|||
else:
|
||||
conn.close()
|
||||
|
||||
if sys.version_info.minor >= 8:
|
||||
_shutdown = asyncio.gather(*coros, loop=loop)
|
||||
else:
|
||||
_shutdown = asyncio.gather(*coros)
|
||||
loop.run_until_complete(_shutdown)
|
||||
|
||||
trigger_events(after_stop, loop)
|
||||
|
|
Loading…
Reference in New Issue
Block a user