import dns.inet
-# This is a nullcontext for both sync and async
+# This is a nullcontext for both sync and async. 3.7 has a nullcontext,
+# but it is only for sync use.
class NullContext:
def __init__(self, enter_result=None):
wire = q.to_wire()
(begin_time, expiration) = _compute_times(timeout)
s = None
+ # After 3.6 is no longer supported, this can use an AsyncExitStack.
try:
if sock:
s = sock
wire = q.to_wire()
(begin_time, expiration) = _compute_times(timeout)
s = None
+ # After 3.6 is no longer supported, this can use an AsyncExitStack.
try:
if sock:
# Verify that the socket is connected, as if it's not connected,
Returns a ``dns.message.Message``.
"""
+ # After 3.6 is no longer supported, this can use an AsyncExitStack.
(begin_time, expiration) = _compute_times(timeout)
if not sock:
if ssl_context is None:
try:
runner = asyncio.run
except AttributeError:
+ # this is only needed for 3.6
def old_runner(awaitable):
loop = asyncio.get_event_loop()
return loop.run_until_complete(awaitable)