Antoine Pitrou wrote:
I feel stupid for not thinking of such an obvious solution.
(by the way, is _thread always available?)

_thread is a builtin module. It's available on every platform that supports threading (which should be all platforms we support). If you want to be extra carefully then use _dummy_thread as a fallback.

try:
    from _thread import allocate_lock as Lock
except ImportError:
    from _dummy_thread import allocate_lock as Lock

By the way I did some testing. We could save the load of the re and couple of sre_* modules by rewriting a tiny bit of linecache. The linecache module is using re to find the "# coding: spec" of a Python source file when the load fails to return the source of a file. It'd reduce the amount of loaded modules by 5.

Remove "import types" from warnings.py and you'll get one for free.

Christian

_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to