File: patcher_importlib_lock.py

package info (click to toggle)
python-eventlet 0.26.1-7%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,916 kB
  • sloc: python: 24,898; makefile: 98
file content (25 lines) | stat: -rw-r--r-- 482 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
__test__ = False


def do_import():
    import encodings.idna


if __name__ == '__main__':
    import sys
    import eventlet

    eventlet.monkey_patch()
    threading = eventlet.patcher.original('threading')

    sys.modules.pop('encodings.idna', None)

    # call "import encodings.idna" in a new thread
    thread = threading.Thread(target=do_import)
    thread.start()

    # call "import encodings.idna" in the main thread
    do_import()

    thread.join()
    print('pass')