File: resolve_test_helper.py

package info (click to toggle)
python-tornado 5.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,292 kB
  • sloc: python: 28,599; sh: 105; ansic: 65; xml: 49; makefile: 48; sql: 23
file content (11 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
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))