[pypy-commit] pypy issue1430: cleanup

bdkearns noreply at buildbot.pypy.org
Fri May 2 00:07:05 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: issue1430
Changeset: r71159:527d7902252d
Date: 2014-05-01 18:03 -0400
http://bitbucket.org/pypy/pypy/changeset/527d7902252d/

Log:	cleanup

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
@@ -18,7 +18,7 @@
         from rpython.rlib.rsocket import rsocket_startup
         rsocket_startup()
         from pypy.module._socket.interp_func import State
-        space.fromcache(State).alloc_lock(space)
+        space.fromcache(State).startup(space)
 
     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
@@ -42,7 +42,7 @@
     Return the true host name, a list of aliases, and a list of IP addresses,
     for a host.  The host argument is a string giving a host name or IP number.
     """
-    lock = space.fromcache(State).gethostbyxxx_lock
+    lock = space.fromcache(State).netdb_lock
     try:
         res = rsocket.gethostbyname_ex(host, lock)
     except SocketError, e:
@@ -56,7 +56,7 @@
     Return the true host name, a list of aliases, and a list of IP addresses,
     for a host.  The host argument is a string giving a host name or IP number.
     """
-    lock = space.fromcache(State).gethostbyxxx_lock
+    lock = space.fromcache(State).netdb_lock
     try:
         res = rsocket.gethostbyaddr(host, lock)
     except SocketError, e:
@@ -315,8 +315,7 @@
 
 class State(object):
     def __init__(self, space):
-        self.gethostbyxxx_lock = None
+        self.netdb_lock = None
 
-    def alloc_lock(self, space):
-        self.gethostbyxxx_lock = space.allocate_lock()
-
+    def startup(self, space):
+        self.netdb_lock = space.allocate_lock()
diff --git a/rpython/rlib/test/test_rsocket.py b/rpython/rlib/test/test_rsocket.py
--- a/rpython/rlib/test/test_rsocket.py
+++ b/rpython/rlib/test/test_rsocket.py
@@ -84,10 +84,10 @@
     import threading
     nthreads = 10
     ip = '8.8.8.8'
-    lock = threading.Lock()
-    domain = gethostbyaddr(ip, lock)[0]
+    domain = gethostbyaddr(ip)[0]
     result = [0] * nthreads
     threads = [None] * nthreads
+    lock = threading.Lock()
     def lookup_addr(ip, i):
         name, aliases, address_list = gethostbyaddr(ip, lock)
         if name == domain:


More information about the pypy-commit mailing list