Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: py3.5
Changeset: r87779:ed4f8611d06a
Date: 2016-10-14 12:01 +0200
http://bitbucket.org/pypy/pypy/changeset/ed4f8611d06a/

Log:    merge heads

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
diff --git a/pypy/module/posix/interp_scandir.py 
b/pypy/module/posix/interp_scandir.py
--- a/pypy/module/posix/interp_scandir.py
+++ b/pypy/module/posix/interp_scandir.py
@@ -284,8 +284,11 @@
     @unwrap_spec(follow_symlinks=bool)
     def descr_stat(self, space, __kwonly__, follow_symlinks=True):
         """return stat_result object for the entry; cached per entry"""
-        st = self.get_stat_or_lstat(follow_symlinks)
-        return build_stat_result(self.space, st)
+        try:
+            st = self.get_stat_or_lstat(follow_symlinks)
+        except OSError as e:
+            raise wrap_oserror2(space, e, self.fget_path(space))
+        return build_stat_result(space, st)
 
     def descr_inode(self, space):
         return space.wrap(self.inode)
diff --git a/pypy/module/posix/test/test_scandir.py 
b/pypy/module/posix/test/test_scandir.py
--- a/pypy/module/posix/test/test_scandir.py
+++ b/pypy/module/posix/test/test_scandir.py
@@ -145,6 +145,7 @@
         assert not d.is_file()
         assert not d.is_dir()
         assert     d.is_symlink()
+        raises(OSError, d.stat)
 
     def test_dir6(self):
         posix = self.posix
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to