Author: mattip <[email protected]>
Branch: issue1430
Changeset: r71150:ea9e10befc8f
Date: 2014-05-01 23:01 +0300
http://bitbucket.org/pypy/pypy/changeset/ea9e10befc8f/

Log:    add lock to pypy module, which will properly handle no-threading
        translation

diff --git a/pypy/module/_socket/__init__.py b/pypy/module/_socket/__init__.py
--- a/pypy/module/_socket/__init__.py
+++ b/pypy/module/_socket/__init__.py
@@ -17,6 +17,7 @@
     def startup(self, space):
         from rpython.rlib.rsocket import rsocket_startup
         rsocket_startup()
+        space.socket_gethostbyxxx_lock = space.allocate_lock()
 
     def buildloaders(cls):
         from rpython.rlib import rsocket
diff --git a/pypy/module/_socket/interp_func.py 
b/pypy/module/_socket/interp_func.py
--- a/pypy/module/_socket/interp_func.py
+++ b/pypy/module/_socket/interp_func.py
@@ -43,7 +43,7 @@
     for a host.  The host argument is a string giving a host name or IP number.
     """
     try:
-        res = rsocket.gethostbyname_ex(host)
+        res = rsocket.gethostbyname_ex(host, space.socket_gethostbyxxx_lock)
     except SocketError, e:
         raise converted_error(space, e)
     return common_wrapgethost(space, res)
@@ -56,7 +56,7 @@
     for a host.  The host argument is a string giving a host name or IP number.
     """
     try:
-        res = rsocket.gethostbyaddr(host)
+        res = rsocket.gethostbyaddr(host, space.socket_gethostbyxxx_lock)
     except SocketError, e:
         raise converted_error(space, e)
     return common_wrapgethost(space, res)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to