[pypy-svn] r16103 - pypy/dist/pypy/tool

arigo at codespeak.net arigo at codespeak.net
Tue Aug 16 22:26:16 CEST 2005


Author: arigo
Date: Tue Aug 16 22:26:15 2005
New Revision: 16103

Modified:
   pypy/dist/pypy/tool/tls.py
Log:
tls.py can provide a complete thread-local object even on top of Python 2.3,
because there is a pure Python version of it in 2.4.  We can hack and import it
from lib-python/2.4.1 and it appears to work nicely on 2.3 as well.

Thanks xorAxAx for pointing this out.



Modified: pypy/dist/pypy/tool/tls.py
==============================================================================
--- pypy/dist/pypy/tool/tls.py	(original)
+++ pypy/dist/pypy/tool/tls.py	Tue Aug 16 22:26:15 2005
@@ -7,5 +7,10 @@
     # XXX needs a real object whose attributes are visible only in
     #     the thread that reads/writes them.
 
-    class tlsobject(object):
-        pass
+    import autopath, os
+    filename = os.path.join(os.path.dirname(autopath.pypydir),
+                            'lib-python', '2.4.1', '_threading_local.py')
+    glob = {'__name__': '_threading_local'}
+    execfile(filename, glob)
+    tlsobject = glob['local']
+    del glob, filename



More information about the Pypy-commit mailing list