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 asyncio
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
@ -134,6 +135,9 @@ class HttpProtocol(asyncio.Protocol):
|
||||||
self.request_class = request_class or Request
|
self.request_class = request_class or Request
|
||||||
self.is_request_stream = is_request_stream
|
self.is_request_stream = is_request_stream
|
||||||
self._is_stream_handler = False
|
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._not_paused = asyncio.Event(loop=loop)
|
||||||
self._total_request_size = 0
|
self._total_request_size = 0
|
||||||
self._request_timeout_handler = None
|
self._request_timeout_handler = None
|
||||||
|
@ -951,7 +955,10 @@ def serve(
|
||||||
else:
|
else:
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
if sys.version_info.minor >= 8:
|
||||||
_shutdown = asyncio.gather(*coros, loop=loop)
|
_shutdown = asyncio.gather(*coros, loop=loop)
|
||||||
|
else:
|
||||||
|
_shutdown = asyncio.gather(*coros)
|
||||||
loop.run_until_complete(_shutdown)
|
loop.run_until_complete(_shutdown)
|
||||||
|
|
||||||
trigger_events(after_stop, loop)
|
trigger_events(after_stop, loop)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user