Files
addon/lib/tornado/test/resolve_test_helper.py
marco 5307db2a3c ops
2019-12-04 20:45:07 +01:00

12 lines
476 B
Python
Executable File

from __future__ import absolute_import, division, print_function
from tornado.ioloop import IOLoop
from tornado.netutil import ThreadedResolver
# When this module is imported, it runs getaddrinfo on a thread. Since
# the hostname is unicode, getaddrinfo attempts to import encodings.idna
# but blocks on the import lock. Verify that ThreadedResolver avoids
# this deadlock.
resolver = ThreadedResolver()
IOLoop.current().run_sync(lambda: resolver.resolve(u'localhost', 80))