[pypy-svn] pypy default: Support ctypes if the interpreter has no threads.

arigo commits-noreply at bitbucket.org
Tue Apr 12 21:06:17 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r43313:6f621aabc17a
Date: 2011-04-12 21:04 +0200
http://bitbucket.org/pypy/pypy/changeset/6f621aabc17a/

Log:	Support ctypes if the interpreter has no threads.

diff --git a/lib_pypy/_ctypes/builtin.py b/lib_pypy/_ctypes/builtin.py
--- a/lib_pypy/_ctypes/builtin.py
+++ b/lib_pypy/_ctypes/builtin.py
@@ -1,6 +1,9 @@
 
 import _rawffi, sys
-import threading
+try:
+    from thread import _local as local
+except ImportError:
+    local = object    # no threads
 
 class ConvMode:
     encoding = 'ascii'
@@ -28,7 +31,7 @@
     arg = cobj._get_buffer_value()
     return _rawffi.wcharp2rawunicode(arg, lgt)
 
-class ErrorObject(threading.local):
+class ErrorObject(local):
     def __init__(self):
         self.errno = 0
         self.winerror = 0


More information about the Pypy-commit mailing list