Author: Richard Plangger <planri...@gmail.com>
Branch: py3.5
Changeset: r87777:f62a92cfbf64
Date: 2016-10-14 11:59 +0200
http://bitbucket.org/pypy/pypy/changeset/f62a92cfbf64/

Log:    modify and pass the test to use the new SemLock api (constructor and
        rebuild)

diff --git a/pypy/module/_multiprocessing/interp_semaphore.py 
b/pypy/module/_multiprocessing/interp_semaphore.py
--- a/pypy/module/_multiprocessing/interp_semaphore.py
+++ b/pypy/module/_multiprocessing/interp_semaphore.py
@@ -519,9 +519,10 @@
         self.count = 0
 
     @unwrap_spec(kind=int, maxvalue=int)
-    def rebuild(space, w_cls, w_handle, kind, maxvalue):
+    def rebuild(space, w_cls, w_handle, kind, maxvalue, w_name):
+        name = space.str_or_None_w(w_name)
         self = space.allocate_instance(W_SemLock, w_cls)
-        self.__init__(space, handle_w(space, w_handle), kind, maxvalue)
+        self.__init__(space, handle_w(space, w_handle), kind, maxvalue, name)
         return space.wrap(self)
 
     def enter(self, space):
diff --git a/pypy/module/_multiprocessing/test/test_semaphore.py 
b/pypy/module/_multiprocessing/test/test_semaphore.py
--- a/pypy/module/_multiprocessing/test/test_semaphore.py
+++ b/pypy/module/_multiprocessing/test/test_semaphore.py
@@ -35,7 +35,7 @@
         maxvalue = 1
         # the following line gets OSError: [Errno 38] Function not implemented
         # if /dev/shm is not mounted on Linux
-        sem = SemLock(kind, value, maxvalue)
+        sem = SemLock(kind, value, maxvalue, "1", False)
         assert sem.kind == kind
         assert sem.maxvalue == maxvalue
         assert isinstance(sem.handle, int)
@@ -68,7 +68,7 @@
         maxvalue = 1
         # the following line gets OSError: [Errno 38] Function not implemented
         # if /dev/shm is not mounted on Linux
-        sem = SemLock(kind, value, maxvalue)
+        sem = SemLock(kind, value, maxvalue, "2", False)
 
         sem.acquire()
         sem.release()
@@ -88,7 +88,7 @@
         kind = self.SEMAPHORE
         value = 1
         maxvalue = 1
-        sem = SemLock(kind, value, maxvalue)
+        sem = SemLock(kind, value, maxvalue, "3", False)
 
         res = sem.acquire()
         assert res == True
@@ -100,9 +100,9 @@
         kind = self.SEMAPHORE
         value = 1
         maxvalue = 1
-        sem = SemLock(kind, value, maxvalue)
+        sem = SemLock(kind, value, maxvalue, "4", False)
 
-        sem2 = SemLock._rebuild(sem.handle, kind, value)
+        sem2 = SemLock._rebuild(sem.handle, kind, value, "10")
         assert sem.handle == sem2.handle
 
     def test_semaphore_contextmanager(self):
@@ -110,7 +110,7 @@
         kind = self.SEMAPHORE
         value = 1
         maxvalue = 1
-        sem = SemLock(kind, value, maxvalue)
+        sem = SemLock(kind, value, maxvalue, "5", False)
 
         with sem:
             assert sem._count() == 1
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to