Files
deb-python-eventlet/tests/patcher_test_importlib_lock.py
Victor Stinner 5e392fea66 Fix monkey_patch() on Python 3
The importlib module must use real thread locks, not eventlet.Semaphore.
2014-12-21 17:45:37 +03:00

31 lines
554 B
Python

from __future__ import print_function
import sys
import eventlet
# no standard tests in this file, ignore
__test__ = False
def do_import():
import encodings.idna
if __name__ == '__main__':
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('ok')